diff options
author | Kim Alvefur <zash@zash.se> | 2020-05-11 21:56:19 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2020-05-11 21:56:19 +0200 |
commit | 82714e54a8dca7ff60365758dd497c3c9c270633 (patch) | |
tree | d3c52660aea85e97cb676dad5994bc6613834fd2 /spec | |
parent | 0cf5e523843ae039f2aa005995cd320d7fe2ff1f (diff) | |
download | prosody-82714e54a8dca7ff60365758dd497c3c9c270633.tar.gz prosody-82714e54a8dca7ff60365758dd497c3c9c270633.zip |
mod_storage_internal: Implement key-value API
Diffstat (limited to 'spec')
-rw-r--r-- | spec/core_storagemanager_spec.lua | 15 |
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 |