Software /
code /
prosody
Comparison
spec/util_datamapper_spec.lua @ 11438:b7807583de34
util.datamapper: Add logic for "boolean" tags here the presence means true
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 07 Mar 2021 01:41:39 +0100 |
parent | 11437:87a684df4b65 |
child | 11439:9abcdfdcdb01 |
comparison
equal
deleted
inserted
replaced
11437:87a684df4b65 | 11438:b7807583de34 |
---|---|
29 }; | 29 }; |
30 state = { | 30 state = { |
31 type = "string"; | 31 type = "string"; |
32 xml = {x_name_is_value = true; namespace = "http://jabber.org/protocol/chatstates"}; | 32 xml = {x_name_is_value = true; namespace = "http://jabber.org/protocol/chatstates"}; |
33 }; | 33 }; |
34 fallback = { | |
35 type = "boolean"; | |
36 xml = {x_name_is_value = true; name = "fallback"; namespace = "urn:xmpp:fallback:0"}; | |
37 }; | |
34 }; | 38 }; |
35 }; | 39 }; |
36 | 40 |
37 x = xml.parse [[ | 41 x = xml.parse [[ |
38 <message xmlns="jabber:client" xml:lang="en" to="a@test" from="b@test" type="chat" id="1"> | 42 <message xmlns="jabber:client" xml:lang="en" to="a@test" from="b@test" type="chat" id="1"> |
39 <body>Hello</body> | 43 <body>Hello</body> |
40 <delay xmlns='urn:xmpp:delay' from='test' stamp='2021-03-07T15:59:08+00:00'>Becasue</delay> | 44 <delay xmlns='urn:xmpp:delay' from='test' stamp='2021-03-07T15:59:08+00:00'>Becasue</delay> |
41 <active xmlns='http://jabber.org/protocol/chatstates'/> | 45 <active xmlns='http://jabber.org/protocol/chatstates'/> |
46 <fallback xmlns='urn:xmpp:fallback:0'/> | |
42 </message> | 47 </message> |
43 ]]; | 48 ]]; |
44 | 49 |
45 d = { | 50 d = { |
46 to = "a@test"; | 51 to = "a@test"; |
49 id = "1"; | 54 id = "1"; |
50 lang = "en"; | 55 lang = "en"; |
51 body = "Hello"; | 56 body = "Hello"; |
52 delay = {from = "test"; stamp = "2021-03-07T15:59:08+00:00"; reason = "Becasue"}; | 57 delay = {from = "test"; stamp = "2021-03-07T15:59:08+00:00"; reason = "Becasue"}; |
53 state = "active"; | 58 state = "active"; |
59 fallback = true; | |
54 }; | 60 }; |
55 end); | 61 end); |
56 | 62 |
57 describe("parse", function() | 63 describe("parse", function() |
58 it("works", function() | 64 it("works", function() |