test: make it easier to understand test failure

This commit is contained in:
fryorcraken.eth 2022-09-07 12:09:23 +10:00
parent e4d4fb1edd
commit 76251c922e
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
1 changed files with 5 additions and 9 deletions

View File

@ -228,10 +228,8 @@ describe("Waku Store", () => {
nwaku = new Nwaku(makeLogFileName(this));
await nwaku.start({ persistMessages: true, store: true, lightpush: true });
const encryptedAsymmetricMessageText =
"This message is encrypted for me using asymmetric";
const encryptedSymmetricMessageText =
"This message is encrypted for me using symmetric encryption";
const encryptedAsymmetricMessageText = "asymmetric encryption";
const encryptedSymmetricMessageText = "symmetric encryption";
const clearMessageText =
"This is a clear text message for everyone to read";
const otherEncMessageText =
@ -307,11 +305,9 @@ describe("Waku Store", () => {
decryptionParams: [{ key: privateKey }],
});
expect(messages?.length).eq(3);
if (!messages) throw "Length was tested";
expect(messages[0].payloadAsUtf8).to.eq(clearMessageText);
expect(messages[1].payloadAsUtf8).to.eq(encryptedSymmetricMessageText);
expect(messages[2].payloadAsUtf8).to.eq(encryptedAsymmetricMessageText);
expect(messages[0]?.payloadAsUtf8).to.eq(clearMessageText);
expect(messages[1]?.payloadAsUtf8).to.eq(encryptedSymmetricMessageText);
expect(messages[2]?.payloadAsUtf8).to.eq(encryptedAsymmetricMessageText);
!!waku1 && waku1.stop().catch((e) => console.log("Waku failed to stop", e));
!!waku2 && waku2.stop().catch((e) => console.log("Waku failed to stop", e));