aboutsummaryrefslogtreecommitdiffstats
path: root/spec
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
commit82714e54a8dca7ff60365758dd497c3c9c270633 (patch)
treed3c52660aea85e97cb676dad5994bc6613834fd2 /spec
parent0cf5e523843ae039f2aa005995cd320d7fe2ff1f (diff)
downloadprosody-82714e54a8dca7ff60365758dd497c3c9c270633.tar.gz
prosody-82714e54a8dca7ff60365758dd497c3c9c270633.zip
mod_storage_internal: Implement key-value API
Diffstat (limited to 'spec')
-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