aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2022-01-06 01:18:35 +0100
committerKim Alvefur <zash@zash.se>2022-01-06 01:18:35 +0100
commit8a97d634a4c5c5d046424c227a4b26bb9f486481 (patch)
treead017e0fe1b3a44a99fb60a0713c8a3443bef91b /spec
parentb5b67241e043e9d5e11a5a21f00b9afe7e795282 (diff)
downloadprosody-8a97d634a4c5c5d046424c227a4b26bb9f486481.tar.gz
prosody-8a97d634a4c5c5d046424c227a4b26bb9f486481.zip
util.pubsub: Fix item store resize to "max"
Previously this would end up passing the "max" directly to the underlying storage.
Diffstat (limited to 'spec')
-rw-r--r--spec/util_pubsub_spec.lua20
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/util_pubsub_spec.lua b/spec/util_pubsub_spec.lua
index 2dc5ca60..45a612a0 100644
--- a/spec/util_pubsub_spec.lua
+++ b/spec/util_pubsub_spec.lua
@@ -169,6 +169,26 @@ describe("util.pubsub", function ()
}, 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 ()