aboutsummaryrefslogtreecommitdiffstats
path: root/spec/util_dataforms_spec.lua
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
commita7448e43e0daa2772511d7744727f91db4962346 (patch)
tree810fd6136e2a41a3b4316066eaccace728e7e185 /spec/util_dataforms_spec.lua
parent5b1a2360296bfec2e8ff7242a6c12cda54521f6a (diff)
downloadprosody-a7448e43e0daa2772511d7744727f91db4962346.tar.gz
prosody-a7448e43e0daa2772511d7744727f91db4962346.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/util_dataforms_spec.lua')
-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);