Diff

spec/util_stanza_spec.lua @ 11088:1f84d0e4d0c4

util.stanza: Extract Application-Specific Condition from errors API change
author Kim Alvefur <zash@zash.se>
date Sat, 26 Sep 2020 18:12:18 +0200
parent 11087:cdd4684992f1
child 11206:f051394762ff
line wrap: on
line diff
--- a/spec/util_stanza_spec.lua	Sat Sep 26 19:00:17 2020 +0200
+++ b/spec/util_stanza_spec.lua	Sat Sep 26 18:12:18 2020 +0200
@@ -276,6 +276,19 @@
 		end);
 	end);
 
+	describe("#get_error()", function ()
+		describe("basics", function ()
+			local s = st.message();
+			local e = st.error_reply(s, "cancel", "not-acceptable", "UNACCEPTABLE!!!! ONE MILLION YEARS DUNGEON!")
+				:tag("dungeon", { xmlns = "urn:uuid:c9026187-5b05-4e70-b265-c3b6338a7d0f", period="1000000years"});
+			local typ, cond, text, extra = e:get_error();
+			assert.equal("cancel", typ);
+			assert.equal("not-acceptable", cond);
+			assert.equal("UNACCEPTABLE!!!! ONE MILLION YEARS DUNGEON!", text);
+			assert.not_nil(extra)
+		end)
+	end)
+
 	describe("should reject #invalid", function ()
 		local invalid_names = {
 			["empty string"] = "", ["characters"] = "<>";