aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2021-03-07 12:48:49 +0100
committerKim Alvefur <zash@zash.se>2021-03-07 12:48:49 +0100
commit07889f274dfb3dbb17988688701602cc43291941 (patch)
tree6cc1dd52bfa322dedd8ab7b713d2db9a865f7771 /spec
parent7cd2803161ee05303371cd681f8ae00a0838d07f (diff)
downloadprosody-07889f274dfb3dbb17988688701602cc43291941.tar.gz
prosody-07889f274dfb3dbb17988688701602cc43291941.zip
util.datamapper: Add support for mapping of elements where only one attribute matters
E.g. <feature var='foo'/> in XEP-0030 and some other simple specifications.
Diffstat (limited to 'spec')
-rw-r--r--spec/util_datamapper_spec.lua7
1 files changed, 7 insertions, 0 deletions
diff --git a/spec/util_datamapper_spec.lua b/spec/util_datamapper_spec.lua
index 7f6ef75e..1f03c850 100644
--- a/spec/util_datamapper_spec.lua
+++ b/spec/util_datamapper_spec.lua
@@ -35,6 +35,10 @@ describe("util.datampper", function()
type = "boolean";
xml = {x_name_is_value = true; name = "fallback"; namespace = "urn:xmpp:fallback:0"};
};
+ origin_id = {
+ type = "string";
+ xml = {name = "origin-id"; namespace = "urn:xmpp:sid:0"; x_single_attribute = "id"};
+ };
};
};
@@ -44,6 +48,7 @@ describe("util.datampper", function()
<delay xmlns='urn:xmpp:delay' from='test' stamp='2021-03-07T15:59:08+00:00'>Becasue</delay>
<active xmlns='http://jabber.org/protocol/chatstates'/>
<fallback xmlns='urn:xmpp:fallback:0'/>
+ <origin-id xmlns='urn:xmpp:sid:0' id='qgkmMdPB'/>
</message>
]];
@@ -57,6 +62,7 @@ describe("util.datampper", function()
delay = {from = "test"; stamp = "2021-03-07T15:59:08+00:00"; reason = "Becasue"};
state = "active";
fallback = true;
+ origin_id = "qgkmMdPB";
};
end);
@@ -75,6 +81,7 @@ describe("util.datampper", function()
assert.equal(x:get_child_text("body"), u:get_child_text("body"));
assert.equal(x:get_child_text("delay", "urn:xmpp:delay"), u:get_child_text("delay", "urn:xmpp:delay"));
assert.same(x:get_child("delay", "urn:xmpp:delay").attr, u:get_child("delay", "urn:xmpp:delay").attr);
+ assert.same(x:get_child("origin-id", "urn:xmpp:sid:0").attr, u:get_child("origin-id", "urn:xmpp:sid:0").attr);
end);
end);
end)