Software /
code /
prosody
Comparison
spec/util_datamapper_spec.lua @ 11487:b104c10ffce7
util.datamapper: Use attribute convenience function throughout
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 26 Mar 2021 12:53:29 +0100 |
parent | 11480:0aa2971380e9 |
child | 11488:332c9291f4d5 |
comparison
equal
deleted
inserted
replaced
11486:78d843faaffc | 11487:b104c10ffce7 |
---|---|
12 | 12 |
13 local s, x, d | 13 local s, x, d |
14 local disco, disco_info, disco_schema | 14 local disco, disco_info, disco_schema |
15 setup(function() | 15 setup(function() |
16 | 16 |
17 -- a convenience function for simple attributes, there's a few of them | |
17 local function attr() return {type = "string"; xml = {attribute = true}} end | 18 local function attr() return {type = "string"; xml = {attribute = true}} end |
18 s = { | 19 s = { |
19 type = "object"; | 20 type = "object"; |
20 xml = {name = "message"; namespace = "jabber:client"}; | 21 xml = {name = "message"; namespace = "jabber:client"}; |
21 properties = { | 22 properties = { |
51 }; | 52 }; |
52 react = { | 53 react = { |
53 type = "object"; | 54 type = "object"; |
54 xml = {namespace = "urn:xmpp:reactions:0"; name = "reactions"}; | 55 xml = {namespace = "urn:xmpp:reactions:0"; name = "reactions"}; |
55 properties = { | 56 properties = { |
56 to = {type = "string"; xml = {attribute = true; name = "id"}}; | 57 to = attr(); |
57 reactions = {type = "array"; items = {type = "string"; xml = {name = "reaction"}}}; | 58 reactions = {type = "array"; items = {type = "string"; xml = {name = "reaction"}}}; |
58 }; | 59 }; |
59 }; | 60 }; |
60 stanza_ids = { | 61 stanza_ids = { |
61 type = "array"; | 62 type = "array"; |
62 items = { | 63 items = { |
63 xml = {name = "stanza-id"; namespace = "urn:xmpp:sid:0"}; | 64 xml = {name = "stanza-id"; namespace = "urn:xmpp:sid:0"}; |
64 type = "object"; | 65 type = "object"; |
65 properties = { | 66 properties = { |
66 id = {xml = {attribute = true}; type = "string"}; | 67 id = attr(); |
67 by = {xml = {attribute = true}; type = "string"}; | 68 by = attr(); |
68 }; | 69 }; |
69 }; | 70 }; |
70 }; | 71 }; |
71 }; | 72 }; |
72 }; | 73 }; |