Software /
code /
prosody
Diff
spec/util_pubsub_spec.lua @ 12153:26af75c20163
util.pubsub: Fix item store resize to "max"
Previously this would end up passing the "max" directly to the
underlying storage.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 06 Jan 2022 01:18:35 +0100 |
parent | 11767:5610f7c5b261 |
line wrap: on
line diff
--- a/spec/util_pubsub_spec.lua Thu Jan 06 00:59:40 2022 +0100 +++ b/spec/util_pubsub_spec.lua Thu Jan 06 01:18:35 2022 +0100 @@ -169,6 +169,26 @@ }, ret); end); + it("has a default max_items", function () + assert.truthy(service.config.max_items); + end) + + it("changes max_items to max", function () + assert.truthy(service:set_node_config("node", true, { max_items = "max" })); + end); + + it("publishes some more items", function() + for i = 4, service.config.max_items + 5 do + assert.truthy(service:publish("node", true, tostring(i), "item " .. tostring(i))); + end + end); + + it("should still return only two items", function () + local ok, ret = service:get_items("node", true); + assert.truthy(ok); + assert.same(service.config.max_items, #ret); + end); + end); describe("the thing", function ()