aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2018-06-02 19:57:46 +0200
committerKim Alvefur <zash@zash.se>2018-06-02 19:57:46 +0200
commit7bc9f73c736d558386cfbce9d57a7dddd0b5479b (patch)
tree810fd6136e2a41a3b4316066eaccace728e7e185 /spec
parentdd0d9009e8491223396cde8e7bccfc9aa168fa0d (diff)
downloadprosody-7bc9f73c736d558386cfbce9d57a7dddd0b5479b.tar.gz
prosody-7bc9f73c736d558386cfbce9d57a7dddd0b5479b.zip
util.dataforms: Add a simple function for identifying form types
This is meant to allow identifying forms without parsing them completely.
Diffstat (limited to 'spec')
-rw-r--r--spec/util_dataforms_spec.lua9
1 files changed, 9 insertions, 0 deletions
diff --git a/spec/util_dataforms_spec.lua b/spec/util_dataforms_spec.lua
index 4b85444f..56751041 100644
--- a/spec/util_dataforms_spec.lua
+++ b/spec/util_dataforms_spec.lua
@@ -301,5 +301,14 @@ describe("util.dataforms", function ()
assert.equal("text-single-value", f:get_child_text("value"));
end);
+ describe("get_type()", function ()
+ it("identifes dataforms", function ()
+ assert.equal(nil, dataforms.get_type(nil));
+ assert.equal(nil, dataforms.get_type(""));
+ assert.equal(nil, dataforms.get_type({}));
+ assert.equal(nil, dataforms.get_type(st.stanza("no-a-form")));
+ assert.equal("xmpp:prosody.im/spec/util.dataforms#1", dataforms.get_type(xform));
+ end);
+ end);
end);