diff options
author | Kim Alvefur <zash@zash.se> | 2020-09-26 19:00:17 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2020-09-26 19:00:17 +0200 |
commit | bdee3ae38c52eb1237dd05bc4237cf15689dba69 (patch) | |
tree | 1ee1ce731e8eed090a847dfad907d13692f517cc /spec | |
parent | a2ec5e4e52adc58ef83d5e20f268f2a1005b13ac (diff) | |
download | prosody-bdee3ae38c52eb1237dd05bc4237cf15689dba69.tar.gz prosody-bdee3ae38c52eb1237dd05bc4237cf15689dba69.zip |
spec.stanza spec: Split up util.error related tests
Diffstat (limited to 'spec')
-rw-r--r-- | spec/util_stanza_spec.lua | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/spec/util_stanza_spec.lua b/spec/util_stanza_spec.lua index ba90eb84..a363086c 100644 --- a/spec/util_stanza_spec.lua +++ b/spec/util_stanza_spec.lua @@ -232,6 +232,7 @@ describe("util.stanza", function() end, "got stanza of type error"); end); + describe("util.error integration", function () 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" }, { by = "this.test" }); @@ -247,12 +248,18 @@ describe("util.stanza", function() 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); + it("should accept util.error objects with an URI", function () + local s = st.message({ to = "touser", from = "fromuser", id = "123", type = "chat" }, "Hello"); local gone = errors.new({ condition = "gone", extra = { uri = "file:///dev/null" } }) local gonner = st.error_reply(s, gone); assert.are.equal("gone", gonner.tags[1].tags[1].name); assert.are.equal("file:///dev/null", gonner.tags[1].tags[1][1]); + end); + it("should accept util.error objects with application specific error", function () + local s = st.message({ to = "touser", from = "fromuser", id = "123", type = "chat" }, "Hello"); local e = errors.new({ condition = "internal-server-error", text = "Namespaced thing happened", extra = {namespace="xmpp:example.test", condition="this-happened"} }) local r = st.error_reply(s, e); @@ -266,6 +273,7 @@ describe("util.stanza", function() assert.are.equal("that-happened", r2.tags[1].tags[3].name); assert.are.equal("here", r2.tags[1].tags[3].attr["another-attribute"]); end); + end); end); describe("should reject #invalid", function () |