Software /
code /
prosody
Comparison
spec/core_storagemanager_spec.lua @ 11276:7b2ee8995af9
storage tests: Add test for querying a set of IDs
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 12 Jan 2021 18:03:40 +0100 |
parent | 11273:9f1355689648 |
child | 11353:367e6beaf8ab |
comparison
equal
deleted
inserted
replaced
11275:b8fada57faf0 | 11276:7b2ee8995af9 |
---|---|
380 assert.equal(2, #item.tags); | 380 assert.equal(2, #item.tags); |
381 end | 381 end |
382 assert.equal(2, count); | 382 assert.equal(2, count); |
383 end); | 383 end); |
384 | 384 |
385 it("by multiple ids", function () | |
386 assert.truthy(archive.caps and archive.caps.ids, "Multilpe ID query") | |
387 local data, err = archive:find("user", { | |
388 ["ids"] = { | |
389 test_data[2][1]; | |
390 test_data[4][1]; | |
391 }; | |
392 }); | |
393 assert.truthy(data, err); | |
394 local count = 0; | |
395 for id, item in data do | |
396 count = count + 1; | |
397 assert.truthy(id); | |
398 assert.equal(test_data[count==1 and 2 or 4][1], id); | |
399 assert(st.is_stanza(item)); | |
400 assert.equal("test", item.name); | |
401 assert.equal("urn:example:foo", item.attr.xmlns); | |
402 assert.equal(2, #item.tags); | |
403 end | |
404 assert.equal(2, count); | |
405 | |
406 end); | |
407 | |
408 | |
385 end); | 409 end); |
386 | 410 |
387 it("can selectively delete items", function () | 411 it("can selectively delete items", function () |
388 local delete_id; | 412 local delete_id; |
389 do | 413 do |