Comparison

spec/util_dataforms_spec.lua @ 8864:cf2f66b233d1

util.dataforms: Add a simple function for identifying form types This is meant to allow identifying forms without parsing them completely.
author Kim Alvefur <zash@zash.se>
date Sat, 02 Jun 2018 19:57:46 +0200
parent 8862:900dff5ef498
child 9046:7cdc718312c8
comparison
equal deleted inserted replaced
8863:64fa8d80c09f 8864:cf2f66b233d1
299 assert.equal("text-single-label", f.attr.label); 299 assert.equal("text-single-label", f.attr.label);
300 assert.equal(1, iter.count(f:childtags("value"))); 300 assert.equal(1, iter.count(f:childtags("value")));
301 assert.equal("text-single-value", f:get_child_text("value")); 301 assert.equal("text-single-value", f:get_child_text("value"));
302 end); 302 end);
303 303
304 describe("get_type()", function ()
305 it("identifes dataforms", function ()
306 assert.equal(nil, dataforms.get_type(nil));
307 assert.equal(nil, dataforms.get_type(""));
308 assert.equal(nil, dataforms.get_type({}));
309 assert.equal(nil, dataforms.get_type(st.stanza("no-a-form")));
310 assert.equal("xmpp:prosody.im/spec/util.dataforms#1", dataforms.get_type(xform));
311 end);
312 end);
304 end); 313 end);
305 314