aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2022-07-29 17:10:31 +0200
committerKim Alvefur <zash@zash.se>2022-07-29 17:10:31 +0200
commit9a375e444474e1e6a97ae57f393f639cfa813846 (patch)
tree4850ca52c7e904255deaa68aedef374fb118c92d /spec
parentc1a166daa79ec4fadd2083dd7097216068f74a28 (diff)
parent2dbbce23823edbf4261df92175d7ee9cf7cca3a9 (diff)
downloadprosody-9a375e444474e1e6a97ae57f393f639cfa813846.tar.gz
prosody-9a375e444474e1e6a97ae57f393f639cfa813846.zip
Merge 0.12->trunk
Diffstat (limited to 'spec')
-rw-r--r--spec/core_storagemanager_spec.lua17
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/core_storagemanager_spec.lua b/spec/core_storagemanager_spec.lua
index 2170420d..04acb1dd 100644
--- a/spec/core_storagemanager_spec.lua
+++ b/spec/core_storagemanager_spec.lua
@@ -575,6 +575,23 @@ describe("storagemanager", function ()
end
end);
+ it("the summary api works", function()
+ assert.truthy(archive:delete("summary-user"));
+ local first_sid = archive:append("summary-user", nil, test_stanza, test_time, "contact@example.com");
+ local second_sid = archive:append("summary-user", nil, test_stanza, test_time+1, "contact@example.com");
+ assert.truthy(first_sid and second_sid, "preparations failed")
+ ---
+
+ local user_summary, err = archive:summary("summary-user");
+ assert.is_table(user_summary, err);
+ assert.same({ ["contact@example.com"] = 2 }, user_summary.counts, "summary.counts matches");
+ assert.same({ ["contact@example.com"] = test_time }, user_summary.earliest, "summary.earliest matches");
+ assert.same({ ["contact@example.com"] = test_time+1 }, user_summary.latest, "summary.latest matches");
+ if user_summary.body then
+ assert.same({ ["contact@example.com"] = test_stanza:get_child_text("body") }, user_summary.body, "summary.body matches");
+ end
+ end);
+
end);
end);
end