Changeset

11353:367e6beaf8ab

storage: Test reverse-ordered queries
author Kim Alvefur <zash@zash.se>
date Mon, 01 Feb 2021 12:17:56 +0100
parents 11352:e10567199f02
children 11354:10fba62332c5
files spec/core_storagemanager_spec.lua
diffstat 1 files changed, 22 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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 ()