Diff

spec/util_stanza_spec.lua @ 10442:22db763c510c

util.stanza: Check that argument to reply is a stanza
author Kim Alvefur <zash@zash.se>
date Mon, 25 Nov 2019 20:44:05 +0100
parent 9924:5a2e53bef031
child 10443:f28718f46196
line wrap: on
line diff
--- a/spec/util_stanza_spec.lua	Sun Nov 24 04:46:36 2019 +0100
+++ b/spec/util_stanza_spec.lua	Mon Nov 25 20:44:05 2019 +0100
@@ -170,6 +170,12 @@
 			assert.are.equal(r.attr.type, "result");
 			assert.are.equal(#r.tags, 0, "A reply should not include children of the original stanza");
 		end);
+
+		it("should reject not-stanzas", function ()
+			assert.has.error_match(function ()
+				st.reply(not "a stanza");
+			end, "expected stanza");
+		end);
 	end);
 
 	describe("#error_reply()", function()