Comparison

spec/core_storagemanager_spec.lua @ 10541:6c6ff4509082

tests: Silence [luacheck] warnings
author Kim Alvefur <zash@zash.se>
date Mon, 23 Dec 2019 21:33:10 +0100
parent 9691:e11e076f0eb8
child 10676:33c7e4920591
comparison
equal deleted inserted replaced
10540:375d31225d53 10541:6c6ff4509082
117 end 117 end
118 end); 118 end);
119 119
120 describe("can be queried", function () 120 describe("can be queried", function ()
121 it("for all items", function () 121 it("for all items", function ()
122 -- luacheck: ignore 211/err
122 local data, err = archive:find("user", {}); 123 local data, err = archive:find("user", {});
123 assert.truthy(data); 124 assert.truthy(data);
124 local count = 0; 125 local count = 0;
125 for id, item, when in data do 126 for id, item, when in data do
126 count = count + 1; 127 count = count + 1;
133 end 134 end
134 assert.equal(#test_data, count); 135 assert.equal(#test_data, count);
135 end); 136 end);
136 137
137 it("by JID", function () 138 it("by JID", function ()
139 -- luacheck: ignore 211/err
138 local data, err = archive:find("user", { 140 local data, err = archive:find("user", {
139 with = "contact@example.com"; 141 with = "contact@example.com";
140 }); 142 });
141 assert.truthy(data); 143 assert.truthy(data);
142 local count = 0; 144 local count = 0;
151 end 153 end
152 assert.equal(1, count); 154 assert.equal(1, count);
153 end); 155 end);
154 156
155 it("by time (end)", function () 157 it("by time (end)", function ()
158 -- luacheck: ignore 211/err
156 local data, err = archive:find("user", { 159 local data, err = archive:find("user", {
157 ["end"] = test_time; 160 ["end"] = test_time;
158 }); 161 });
159 assert.truthy(data); 162 assert.truthy(data);
160 local count = 0; 163 local count = 0;
169 end 172 end
170 assert.equal(2, count); 173 assert.equal(2, count);
171 end); 174 end);
172 175
173 it("by time (start)", function () 176 it("by time (start)", function ()
177 -- luacheck: ignore 211/err
174 local data, err = archive:find("user", { 178 local data, err = archive:find("user", {
175 ["start"] = test_time; 179 ["start"] = test_time;
176 }); 180 });
177 assert.truthy(data); 181 assert.truthy(data);
178 local count = 0; 182 local count = 0;
187 end 191 end
188 assert.equal(#test_data -1, count); 192 assert.equal(#test_data -1, count);
189 end); 193 end);
190 194
191 it("by time (start+end)", function () 195 it("by time (start+end)", function ()
196 -- luacheck: ignore 211/err
192 local data, err = archive:find("user", { 197 local data, err = archive:find("user", {
193 ["start"] = test_time; 198 ["start"] = test_time;
194 ["end"] = test_time+1; 199 ["end"] = test_time+1;
195 }); 200 });
196 assert.truthy(data); 201 assert.truthy(data);
237 assert.equal(#test_data-1, count); 242 assert.equal(#test_data-1, count);
238 end 243 end
239 end); 244 end);
240 245
241 it("can be purged", function () 246 it("can be purged", function ()
247 -- luacheck: ignore 211/err
242 local ok, err = archive:delete("user"); 248 local ok, err = archive:delete("user");
243 assert.truthy(ok); 249 assert.truthy(ok);
244 local data, err = archive:find("user", { 250 local data, err = archive:find("user", {
245 with = "contact@example.com"; 251 with = "contact@example.com";
246 }); 252 });