spec/util_jid_spec.lua
changeset 12194 3616128cd2e3
parent 11059 5fb95410f89c
child 12771 3b75943fa5c1
--- a/spec/util_jid_spec.lua	Sat Jan 15 15:40:29 2022 +0100
+++ b/spec/util_jid_spec.lua	Sat Jan 15 16:25:25 2022 +0100
@@ -13,6 +13,11 @@
 			assert.are.equal(jid.join(nil, nil, "c"), nil, "invalid JID is nil");
 			assert.are.equal(jid.join("a", nil, "c"), nil, "invalid JID is nil");
 		end);
+		it("should reject invalid arguments", function ()
+			assert.has_error(function () jid.join(false, "bork", nil) end)
+			assert.has_error(function () jid.join(nil, "bork", false) end)
+			assert.has_error(function () jid.join(false, false, false) end)
+		end)
 	end);
 	describe("#split()", function()
 		it("should work", function()
@@ -38,6 +43,9 @@
 			test("@server/resource", nil, nil, nil);
 			test("@/resource", nil, nil, nil);
 		end);
+		it("should reject invalid arguments", function ()
+			assert.has_error(function () jid.split(false) end)
+		end)
 	end);
 
 
@@ -59,6 +67,9 @@
 			assert.are.equal(jid.bare("user@@host/resource"), nil, "invalid JID is nil");
 			assert.are.equal(jid.bare("user@host/"), nil, "invalid JID is nil");
 		end);
+		it("should reject invalid arguments", function ()
+			assert.has_error(function () jid.bare(false) end)
+		end)
 	end);
 
 	describe("#compare()", function()