Software /
code /
prosody
Diff
spec/core_storagemanager_spec.lua @ 11276:7b2ee8995af9
storage tests: Add test for querying a set of IDs
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 12 Jan 2021 18:03:40 +0100 |
parent | 11273:9f1355689648 |
child | 11353:367e6beaf8ab |
line wrap: on
line diff
--- a/spec/core_storagemanager_spec.lua Tue Jan 12 17:00:27 2021 +0100 +++ b/spec/core_storagemanager_spec.lua Tue Jan 12 18:03:40 2021 +0100 @@ -382,6 +382,30 @@ assert.equal(2, count); end); + it("by multiple ids", function () + assert.truthy(archive.caps and archive.caps.ids, "Multilpe ID query") + local data, err = archive:find("user", { + ["ids"] = { + test_data[2][1]; + test_data[4][1]; + }; + }); + assert.truthy(data, err); + local count = 0; + for id, item in data do + count = count + 1; + assert.truthy(id); + assert.equal(test_data[count==1 and 2 or 4][1], id); + assert(st.is_stanza(item)); + assert.equal("test", item.name); + assert.equal("urn:example:foo", item.attr.xmlns); + assert.equal(2, #item.tags); + end + assert.equal(2, count); + + end); + + end); it("can selectively delete items", function ()