Diff

spec/util_stanza_spec.lua @ 11083:4d12a6785531

util.stanza: Support getting 'by' from util.error object
author Kim Alvefur <zash@zash.se>
date Sat, 26 Sep 2020 17:26:31 +0200
parent 10717:05e4645fc9b3
child 11084:5e09a3389adb
line wrap: on
line diff
--- a/spec/util_stanza_spec.lua	Sat Sep 26 17:18:17 2020 +0200
+++ b/spec/util_stanza_spec.lua	Sat Sep 26 17:26:31 2020 +0200
@@ -234,7 +234,7 @@
 
 		it("should accept util.error objects", function ()
 			local s = st.message({ to = "touser", from = "fromuser", id = "123", type = "chat" }, "Hello");
-			local e = errors.new({ type = "modify", condition = "not-acceptable", text = "Bork bork bork" });
+			local e = errors.new({ type = "modify", condition = "not-acceptable", text = "Bork bork bork", extra = { by = "this.test" } });
 			local r = st.error_reply(s, e);
 
 			assert.are.equal(r.name, s.name);
@@ -246,6 +246,7 @@
 			assert.are.equal(r.tags[1].attr.type, e.type);
 			assert.are.equal(r.tags[1].tags[1].name, e.condition);
 			assert.are.equal(r.tags[1].tags[2]:get_text(), e.text);
+			assert.are.equal("this.test", r.tags[1].attr.by);
 		end);
 
 	end);