Diff

spec/util_stanza_spec.lua @ 9630:bff66c3faceb 0.11

util.stanza: Validate input to clone() (with brief tests)
author Kim Alvefur <zash@zash.se>
date Sat, 17 Nov 2018 15:26:11 +0100
parent 9308:21c2f3331c59
child 9673:e7e75b091c96
line wrap: on
line diff
--- a/spec/util_stanza_spec.lua	Thu Nov 15 21:55:16 2018 +0000
+++ b/spec/util_stanza_spec.lua	Sat Nov 17 15:26:11 2018 +0100
@@ -346,4 +346,18 @@
 			end, "Invalid stanza");
 		end);
 	end);
+
+	describe("#clone", function ()
+		it("works", function ()
+			local s = st.message({type="chat"}, "Hello"):reset();
+			local c = st.clone(s);
+			assert.same(s, c);
+		end);
+
+		it("works", function ()
+			assert.has_error(function ()
+				st.clone("this is not a stanza");
+			end);
+		end);
+	end);
 end);