# HG changeset patch # User Kim Alvefur # Date 1612178276 -3600 # Node ID 367e6beaf8ab2ca9f9432251bac0f073adc93e85 # Parent e10567199f02ad5afd66418a725765adf54cafe2 storage: Test reverse-ordered queries diff -r e10567199f02 -r 367e6beaf8ab spec/core_storagemanager_spec.lua --- a/spec/core_storagemanager_spec.lua Sun Jan 31 21:10:03 2021 +0100 +++ b/spec/core_storagemanager_spec.lua Mon Feb 01 12:17:56 2021 +0100 @@ -406,6 +406,28 @@ 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 ()