Add wait for remote peer (filter) test

This commit is contained in:
Franck Royer 2022-05-27 20:19:35 +10:00
parent 2e09b6dec3
commit b93e535af9
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
1 changed files with 23 additions and 0 deletions

View File

@ -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;
});
});