From b276ccd52947d7377df181b8fd05fddae04929f0 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Mon, 1 Feb 2021 12:17:56 +0100 Subject: storage: Test reverse-ordered queries --- spec/core_storagemanager_spec.lua | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'spec') diff --git a/spec/core_storagemanager_spec.lua b/spec/core_storagemanager_spec.lua index 033559b4..cf9429c1 100644 --- a/spec/core_storagemanager_spec.lua +++ b/spec/core_storagemanager_spec.lua @@ -406,6 +406,28 @@ describe("storagemanager", function () end); + it("can be queried in reverse", function () + + local data, err = archive:find("user", { + reverse = true; + limit = 3; + }); + assert.truthy(data, err); + + local i = #test_data; + for id, item in data do + assert.truthy(id); + assert.equal(test_data[i][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); + i = i - 1; + end + + end); + + end); it("can selectively delete items", function () -- cgit v1.2.3