From 6b58f08bc1fbe8b6b362521ca64c6125a31e99ad Mon Sep 17 00:00:00 2001 From: Danish Arora Date: Fri, 13 Sep 2024 15:28:39 +0530 Subject: [PATCH] chore: update tests --- .../tests/tests/light-push/peer_management.spec.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/packages/tests/tests/light-push/peer_management.spec.ts b/packages/tests/tests/light-push/peer_management.spec.ts index 1c7fa59d44..5156a3c89b 100644 --- a/packages/tests/tests/light-push/peer_management.spec.ts +++ b/packages/tests/tests/light-push/peer_management.spec.ts @@ -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"; @@ -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); - } }); });