From 07889f274dfb3dbb17988688701602cc43291941 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sun, 7 Mar 2021 12:48:49 +0100 Subject: util.datamapper: Add support for mapping of elements where only one attribute matters E.g. in XEP-0030 and some other simple specifications. --- spec/util_datamapper_spec.lua | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'spec') 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() Becasue + ]]; @@ -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) -- cgit v1.2.3