aboutsummaryrefslogtreecommitdiffstats
path: root/spec/core_storagemanager_spec.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2020-05-11 21:56:19 +0200
committerKim Alvefur <zash@zash.se>2020-05-11 21:56:19 +0200
commitb9bb7cca20ac53685a13fd096a74abd1ae5eb3d3 (patch)
treed3c52660aea85e97cb676dad5994bc6613834fd2 /spec/core_storagemanager_spec.lua
parentc3058505713cfbad76812f7797d52cc32e626fea (diff)
downloadprosody-b9bb7cca20ac53685a13fd096a74abd1ae5eb3d3.tar.gz
prosody-b9bb7cca20ac53685a13fd096a74abd1ae5eb3d3.zip
mod_storage_internal: Implement key-value API
Diffstat (limited to 'spec/core_storagemanager_spec.lua')
-rw-r--r--spec/core_storagemanager_spec.lua15
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/core_storagemanager_spec.lua b/spec/core_storagemanager_spec.lua
index 29ab014f..96ccceb6 100644
--- a/spec/core_storagemanager_spec.lua
+++ b/spec/core_storagemanager_spec.lua
@@ -439,6 +439,21 @@ describe("storagemanager", function ()
assert.equal(2, count);
assert(archive:delete("user-issue1073"));
end);
+
+ it("can be treated as a map store", function ()
+ assert.falsy(archive:get("mapuser", "no-such-id"));
+ assert.falsy(archive:set("mapuser", "no-such-id", test_stanza));
+
+ local id = archive:append("mapuser", nil, test_stanza, test_time, "contact@example.com");
+ assert.same(test_stanza, archive:get("mapuser", id));
+
+ local replacement_stanza = st.stanza("test", { xmlns = "urn:example:foo" })
+ :tag("bar"):up()
+ :reset();
+ assert(archive:set("mapuser", id, replacement_stanza));
+ assert.same(replacement_stanza, archive:get("mapuser", id));
+ end);
+
end);
end);
end