Mercurial > prosody-hg
diff spec/core_storagemanager_spec.lua @ 14011:f77911437539 13.0
mod_storage_internal: Return item-not-found for unknown before/after ids
This is required per XEP-0313, otherwise clients cannot tell the difference
between an empty successful query and a query where their sync point is no
longer within the archive.
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Fri, 12 Dec 2025 12:43:23 +0000 |
| parents | cbd234461c41 |
| children |
line wrap: on
line diff
--- a/spec/core_storagemanager_spec.lua Fri Dec 12 11:31:04 2025 +0000 +++ b/spec/core_storagemanager_spec.lua Fri Dec 12 12:43:23 2025 +0000 @@ -621,7 +621,44 @@ assert.equal(2, count); end); + it("for non-existent after id returning error", function () + do + local data, err = archive:find("user", { + ["after"] = "non-existent-id"; + }); + assert.is_falsy(data); + assert.is_equal("item-not-found", err); + end + do + local data, err = archive:find("user", { + ["after"] = "non-existent-id"; + ["reverse"] = true; + }); + assert.is_falsy(data); + assert.is_equal("item-not-found", err); + end + end); + + it("for non-existent before id returning error", function () + do + local data, err = archive:find("user", { + ["before"] = "non-existent-id"; + }); + assert.is_falsy(data); + assert.is_equal("item-not-found", err); + end + + do + local data, err = archive:find("user", { + ["before"] = "non-existent-id"; + ["reverse"] = true; + }); + assert.is_falsy(data); + assert.is_equal("item-not-found", err); + end + + end); end); @@ -791,3 +828,4 @@ end); end end); +
