Software /
code /
prosody
Comparison
spec/core_storagemanager_spec.lua @ 9467:2098794ac866
storagemanager tests: Add some additional checks
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Wed, 10 Oct 2018 22:03:11 +0100 |
parent | 9466:b70ce39d366f |
child | 9470:0d491bc98b9f |
comparison
equal
deleted
inserted
replaced
9466:b70ce39d366f | 9467:2098794ac866 |
---|---|
106 it("can be queried", function () | 106 it("can be queried", function () |
107 local data, err = archive:find("user", { | 107 local data, err = archive:find("user", { |
108 with = "contact@example.com"; | 108 with = "contact@example.com"; |
109 }); | 109 }); |
110 assert.truthy(data); | 110 assert.truthy(data); |
111 local count = 0; | |
111 for id, item, when in data do | 112 for id, item, when in data do |
113 count = count + 1; | |
112 assert.truthy(id); | 114 assert.truthy(id); |
113 assert(st.is_stanza(item)); | 115 assert(st.is_stanza(item)); |
114 assert.equal("test", item.name); | 116 assert.equal("test", item.name); |
115 assert.equal("urn:example:foo", item.attr.xmlns); | 117 assert.equal("urn:example:foo", item.attr.xmlns); |
116 assert.equal(2, #item.tags); | 118 assert.equal(2, #item.tags); |
117 assert.equal(test_time, when); | 119 assert.equal(test_time, when); |
118 end | 120 end |
121 assert.equal(1, count); | |
119 end); | 122 end); |
120 it("can be purged", function () | 123 it("can be purged", function () |
121 local ok, err = archive:delete("user"); | 124 local ok, err = archive:delete("user"); |
122 assert.truthy(ok); | 125 assert.truthy(ok); |
126 local data, err = archive:find("user", { | |
127 with = "contact@example.com"; | |
128 }); | |
129 assert.truthy(data); | |
130 local count = 0; | |
131 for id, item, when in data do -- luacheck: ignore id item when | |
132 count = count + 1; | |
133 end | |
134 assert.equal(0, count); | |
123 end); | 135 end); |
124 end); | 136 end); |
125 end); | 137 end); |
126 end | 138 end |
127 end); | 139 end); |