Comparison

spec/core_storagemanager_spec.lua @ 13402:6877786d73d7

mod_storage_internal, tests: Fix before/after combined with the 'reverse' flag
author Matthew Wild <mwild1@gmail.com>
date Tue, 12 Dec 2023 13:41:14 +0000
parent 13244:2902c54f45a6
comparison
equal deleted inserted replaced
13401:626ab0af83af 13402:6877786d73d7
558 i = i - 1; 558 i = i - 1;
559 end 559 end
560 560
561 end); 561 end);
562 562
563 -- This tests combines the reverse flag with 'before' and 'after' to
564 -- ensure behaviour remains correct
565 it("by id (before and after) in reverse #full_id_range", function ()
566 assert.truthy(archive.caps and archive.caps.full_id_range, "full ID range support")
567 local data, err = archive:find("user", {
568 ["after"] = test_data[1][1];
569 ["before"] = test_data[4][1];
570 reverse = true;
571 });
572 assert.truthy(data, err);
573 local count = 0;
574 for id, item in data do
575 count = count + 1;
576 assert.truthy(id);
577 assert.equal(test_data[4-count][1], id);
578 assert(st.is_stanza(item));
579 assert.equal("test", item.name);
580 assert.equal("urn:example:foo", item.attr.xmlns);
581 assert.equal(2, #item.tags);
582 end
583 assert.equal(2, count);
584 end);
585
586
563 587
564 end); 588 end);
565 589
566 it("can selectively delete items", function () 590 it("can selectively delete items", function ()
567 local delete_id; 591 local delete_id;