aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2021-03-24 00:34:22 +0100
committerKim Alvefur <zash@zash.se>2021-03-24 00:34:22 +0100
commitd68de27a5dffaae65b82cdb45e6cae415ce305a5 (patch)
tree7f4166b13a461483051275c61db42a39d94cb639 /spec
parent13185a16ae4306fc13a45713381f0487c8e11526 (diff)
downloadprosody-d68de27a5dffaae65b82cdb45e6cae415ce305a5.tar.gz
prosody-d68de27a5dffaae65b82cdb45e6cae415ce305a5.zip
util.datamapper: Add test coverage of unwrapped arrays of objects
Should the xml name/ns go on the array or the items schema? The later apparently.
Diffstat (limited to 'spec')
-rw-r--r--spec/util_datamapper_spec.lua14
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/util_datamapper_spec.lua b/spec/util_datamapper_spec.lua
index 8a4eacfa..5246aced 100644
--- a/spec/util_datamapper_spec.lua
+++ b/spec/util_datamapper_spec.lua
@@ -57,6 +57,17 @@ describe("util.datampper", function()
reactions = {type = "array"; items = {type = "string"; xml = {name = "reaction"}}};
};
};
+ stanza_ids = {
+ type = "array";
+ items = {
+ xml = {name = "stanza-id"; namespace = "urn:xmpp:sid:0"};
+ type = "object";
+ properties = {
+ id = {xml = {attribute = true}; type = "string"};
+ by = {xml = {attribute = true}; type = "string"};
+ };
+ };
+ };
};
};
@@ -68,6 +79,8 @@ describe("util.datampper", function()
<active xmlns='http://jabber.org/protocol/chatstates'/>
<fallback xmlns='urn:xmpp:fallback:0'/>
<origin-id xmlns='urn:xmpp:sid:0' id='qgkmMdPB'/>
+ <stanza-id xmlns='urn:xmpp:sid:0' id='abc1' by='muc'/>
+ <stanza-id xmlns='urn:xmpp:sid:0' id='xyz2' by='host'/>
<reactions id='744f6e18-a57a-11e9-a656-4889e7820c76' xmlns='urn:xmpp:reactions:0'>
<reaction>👋</reaction>
<reaction>🐢</reaction>
@@ -86,6 +99,7 @@ describe("util.datampper", function()
state = "active";
fallback = true;
origin_id = "qgkmMdPB";
+ stanza_ids = {{id = "abc1"; by = "muc"}; {id = "xyz2"; by = "host"}};
react = {
to = "744f6e18-a57a-11e9-a656-4889e7820c76";
reactions = {