From b93e535af90eca1aed70d80ba2e0bb5e53a44cd7 Mon Sep 17 00:00:00 2001 From: Franck Royer Date: Fri, 27 May 2022 20:19:35 +1000 Subject: [PATCH] Add wait for remote peer (filter) test --- src/lib/waku.node.spec.ts | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/lib/waku.node.spec.ts b/src/lib/waku.node.spec.ts index d854c634d4..134235dc0e 100644 --- a/src/lib/waku.node.spec.ts +++ b/src/lib/waku.node.spec.ts @@ -305,4 +305,27 @@ describe("Wait for remote peer / get peers", function () { expect(nimPeerId).to.not.be.undefined; expect(peers.includes(nimPeerId as string)).to.be.true; }); + + it("Filter", async function () { + this.timeout(20_000); + nwaku = new Nwaku(makeLogFileName(this)); + await nwaku.start({ filter: true }); + const multiAddrWithId = await nwaku.getMultiaddrWithId(); + + waku = await Waku.create({ + staticNoiseKey: NOISE_KEY_1, + }); + await waku.dial(multiAddrWithId); + await waku.waitForRemotePeer([Protocols.Filter]); + + const peers = []; + for await (const peer of waku.filter.peers) { + peers.push(peer.id.toB58String()); + } + + const nimPeerId = multiAddrWithId.getPeerId(); + + expect(nimPeerId).to.not.be.undefined; + expect(peers.includes(nimPeerId as string)).to.be.true; + }); });