diff options
Diffstat (limited to 'spec/util_pubsub_spec.lua')
-rw-r--r-- | spec/util_pubsub_spec.lua | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/util_pubsub_spec.lua b/spec/util_pubsub_spec.lua index f876089e..5140a411 100644 --- a/spec/util_pubsub_spec.lua +++ b/spec/util_pubsub_spec.lua @@ -509,4 +509,23 @@ describe("util.pubsub", function () end); end); + describe("persist_items", function() + it("can be disabled", function() + local broadcaster = spy.new(function(notif_type, node_name, subscribers, item) -- luacheck: ignore 212 + end); + local service = pubsub.new { node_defaults = { persist_items = false }, broadcaster = broadcaster } + + local ok = service:create("node", true) + assert.truthy(ok); + + local ok = service:publish("node", true, "1", "item"); + assert.truthy(ok); + assert.spy(broadcaster).was_called(); + + local ok, items = service:get_items("node", true); + assert.truthy(ok); + assert.same(items, {}); + end); + + end) end); |