Mercurial > prosody-hg
comparison spec/muc_util_spec.lua @ 11200:bf8f2da84007
Merge 0.11->trunk
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Thu, 05 Nov 2020 22:31:25 +0100 |
| parents | ad86b93093a3 |
| children |
comparison
equal
deleted
inserted
replaced
| 11199:6c7c50a4de32 | 11200:bf8f2da84007 |
|---|---|
| 1 local muc_util; | 1 local muc_util; |
| 2 | 2 |
| 3 local st = require "util.stanza"; | 3 local st = require "util.stanza"; |
| 4 | 4 |
| 5 do | 5 do |
| 6 local old_pp = package.path; | 6 -- XXX Hack for lack of a mock moduleapi |
| 7 package.path = "./?.lib.lua;"..package.path; | 7 local env = setmetatable({ |
| 8 muc_util = require "plugins.muc.util"; | 8 module = { |
| 9 package.path = old_pp; | 9 _shared = {}; |
| 10 end | 10 -- Close enough to the real module:shared() for our purposes here |
| 11 shared = function (self, name) | |
| 12 local t = self._shared[name]; | |
| 13 if t == nil then | |
| 14 t = {}; | |
| 15 self._shared[name] = t; | |
| 16 end | |
| 17 return t; | |
| 18 end; | |
| 19 } | |
| 20 }, { __index = _ENV or _G }); | |
| 21 muc_util = require "util.envload".envloadfile("plugins/muc/util.lib.lua", env)(); | |
| 22 end | |
| 11 | 23 |
| 12 describe("muc/util", function () | 24 describe("muc/util", function () |
| 13 describe("filter_muc_x()", function () | 25 describe("filter_muc_x()", function () |
| 14 it("correctly filters muc#user", function () | 26 it("correctly filters muc#user", function () |
| 15 local stanza = st.message({ to = "to", from = "from", id = "foo" }) | 27 local stanza = st.message({ to = "to", from = "from", id = "foo" }) |
