Software /
code /
prosody
Comparison
spec/util_stanza_spec.lua @ 9000:4d64ff0719a6
util.stanza: Brief tests for :remove_children
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 08 Jul 2018 19:13:14 +0200 |
parent | 8641:c7734b59506f |
child | 9216:ba38a947020e |
comparison
equal
deleted
inserted
replaced
8999:a2a4c225a3f8 | 9000:4d64ff0719a6 |
---|---|
233 end); | 233 end); |
234 it("identifies tables as not stanzas", function () | 234 it("identifies tables as not stanzas", function () |
235 assert.falsy(st.is_stanza({})); | 235 assert.falsy(st.is_stanza({})); |
236 end); | 236 end); |
237 end); | 237 end); |
238 | |
239 describe("#remove_children", function () | |
240 it("should work", function () | |
241 local s = st.stanza("x", {xmlns="test"}) | |
242 :tag("y", {xmlns="test"}):up() | |
243 :tag("z", {xmlns="test2"}):up() | |
244 :tag("x", {xmlns="test2"}):up() | |
245 | |
246 s:remove_children("x"); | |
247 assert.falsy(s:get_child("x")) | |
248 assert.truthy(s:get_child("z","test2")); | |
249 assert.truthy(s:get_child("x","test2")); | |
250 | |
251 s:remove_children(nil, "test2"); | |
252 assert.truthy(s:get_child("y")) | |
253 assert.falsy(s:get_child(nil,"test2")); | |
254 | |
255 s:remove_children(); | |
256 assert.falsy(s.tags[1]); | |
257 end); | |
258 end); | |
259 | |
238 end); | 260 end); |