Software /
code /
prosody
Diff
spec/util_stanza_spec.lua @ 8621:e3e9479d526e
util.stanza: Test coverage of is_stanza()
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 17 Mar 2018 19:50:22 +0100 |
parent | 8599:62bfc85a53c8 |
child | 8626:20532f191f8d |
line wrap: on
line diff
--- a/spec/util_stanza_spec.lua Sat Mar 17 19:47:48 2018 +0100 +++ b/spec/util_stanza_spec.lua Sat Mar 17 19:50:22 2018 +0100 @@ -198,4 +198,20 @@ end); end); end); + + describe("#is_stanza", function () + -- is_stanza(any) -> boolean + it("identifies stanzas as stanzas", function () + assert.truthy(st.is_stanza(st.stanza("x"))); + end); + it("identifies strings as not stanzas", function () + assert.falsy(st.is_stanza("")); + end); + it("identifies numbers as not stanzas", function () + assert.falsy(st.is_stanza(1)); + end); + it("identifies tables as not stanzas", function () + assert.falsy(st.is_stanza({})); + end); + end); end);