3 local st
= require
"util.stanza";
6 local old_pp
= package
.path
;
7 package
.path
= "./?.lib.lua;"..package
.path
;
8 muc_util
= require
"plugins.muc.util";
12 describe("muc/util", function ()
13 describe("filter_muc_x()", function ()
14 it("correctly filters muc#user", function ()
15 local stanza
= st
.message({ to
= "to", from
= "from", id
= "foo" })
16 :tag("x", { xmlns
= "http://jabber.org/protocol/muc#user" })
17 :tag("invite", { to
= "user@example.com" });
19 assert.equal(1, #stanza
.tags
);
20 assert.equal(stanza
, muc_util
.filter_muc_x(stanza
));
21 assert.equal(0, #stanza
.tags
);
24 it("correctly filters muc#user on a cloned stanza", function ()
25 local stanza
= st
.message({ to
= "to", from
= "from", id
= "foo" })
26 :tag("x", { xmlns
= "http://jabber.org/protocol/muc#user" })
27 :tag("invite", { to
= "user@example.com" });
29 assert.equal(1, #stanza
.tags
);
30 local filtered
= muc_util
.filter_muc_x(st
.clone(stanza
));
31 assert.equal(1, #stanza
.tags
);
32 assert.equal(0, #filtered
.tags
);