Software /
code /
prosody
Comparison
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 |
comparison
equal
deleted
inserted
replaced
12152:0939675955f1 | 12153:26af75c20163 |
---|---|
165 "3", | 165 "3", |
166 "2", | 166 "2", |
167 ["2"] = "item 2", | 167 ["2"] = "item 2", |
168 ["3"] = "item 3", | 168 ["3"] = "item 3", |
169 }, ret); | 169 }, ret); |
170 end); | |
171 | |
172 it("has a default max_items", function () | |
173 assert.truthy(service.config.max_items); | |
174 end) | |
175 | |
176 it("changes max_items to max", function () | |
177 assert.truthy(service:set_node_config("node", true, { max_items = "max" })); | |
178 end); | |
179 | |
180 it("publishes some more items", function() | |
181 for i = 4, service.config.max_items + 5 do | |
182 assert.truthy(service:publish("node", true, tostring(i), "item " .. tostring(i))); | |
183 end | |
184 end); | |
185 | |
186 it("should still return only two items", function () | |
187 local ok, ret = service:get_items("node", true); | |
188 assert.truthy(ok); | |
189 assert.same(service.config.max_items, #ret); | |
170 end); | 190 end); |
171 | 191 |
172 end); | 192 end); |
173 | 193 |
174 describe("the thing", function () | 194 describe("the thing", function () |