Software /
code /
prosody
Diff
spec/util_datamapper_spec.lua @ 11439:9abcdfdcdb01
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.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 07 Mar 2021 12:48:49 +0100 |
parent | 11438:b7807583de34 |
child | 11453:f0037234b2e9 |
line wrap: on
line diff
--- a/spec/util_datamapper_spec.lua Sun Mar 07 01:41:39 2021 +0100 +++ b/spec/util_datamapper_spec.lua Sun Mar 07 12:48:49 2021 +0100 @@ -35,6 +35,10 @@ 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 @@ <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 @@ 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 @@ 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)