test: compare all messages at once

Makes it easier to understand the order mismatch.
This commit is contained in:
fryorcraken.eth 2022-11-15 15:32:34 +11:00
parent 11c9823a9d
commit 74d7bb90c7
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
1 changed files with 4 additions and 14 deletions

View File

@ -225,13 +225,8 @@ describe("Waku Store", () => {
);
expect(messages?.length).eq(totalMsgs);
for (let index = 0; index < totalMsgs; index++) {
expect(
messages?.findIndex((msg) => {
return msg.payload![0]! === index;
})
).to.eq(index);
}
const payloads = messages.map((msg) => msg.payload![0]!);
expect(payloads).to.deep.eq(Array.from(Array(totalMsgs).keys()));
});
it("Ordered Callback - Backward", async function () {
@ -270,13 +265,8 @@ describe("Waku Store", () => {
messages = messages.reverse();
expect(messages?.length).eq(totalMsgs);
for (let index = 0; index < totalMsgs; index++) {
expect(
messages?.findIndex((msg) => {
return msg.payload![0]! === index;
})
).to.eq(index);
}
const payloads = messages.map((msg) => msg.payload![0]!);
expect(payloads).to.deep.eq(Array.from(Array(totalMsgs).keys()));
});
it("Generator, with asymmetric & symmetric encrypted messages", async function () {