Skip to content

Commit

Permalink
chore: update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
danisharora099 committed Sep 13, 2024
1 parent c0e6e05 commit 6b58f08
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions packages/tests/tests/light-push/peer_management.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { LightNode } from "@waku/interfaces";
import { createEncoder, utf8ToBytes } from "@waku/sdk";
import { delay } from "@waku/utils";
import { expect } from "chai";
import { describe } from "mocha";

Expand Down Expand Up @@ -78,18 +79,21 @@ describe("Waku Light Push: Peer Management: E2E", function () {
expect(response2.failures).to.have.length(1);
expect(response2.failures?.[0].peerId).to.equal(peerToDisconnect);

// send another lightpush request -- renewal should have triggerred and new peer should be used instead of the disconnected one
// send another lightpush request
// reattempts to send should be triggerred
// then renewal should happen
// so one failure should exist
const response3 = await waku.lightPush.send(encoder, {
payload: utf8ToBytes("Hello_World")
});

// wait for reattempts to finish as they are async and not awaited
await delay(500);

expect(response3.successes.length).to.be.equal(
waku.lightPush.numPeersToUse
waku.lightPush.numPeersToUse - 1
);

expect(response3.successes).to.not.include(peerToDisconnect);
if (response3.failures) {
expect(response3.failures.length).to.equal(0);
}
});
});

0 comments on commit 6b58f08

Please sign in to comment.