Skip to content

Commit

Permalink
address minor comments
Browse files Browse the repository at this point in the history
  • Loading branch information
danisharora099 committed Jan 10, 2024
1 parent ab29a15 commit 0cd283a
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions packages/tests/tests/peer_exchange.node.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,22 +77,19 @@ describe("Peer Exchange", () => {
expect(peerInfos[0].ENR).to.not.be.null;
expect(peerInfos[0].ENR?.peerInfo?.multiaddrs).to.not.be.null;

let foundNodeMas: Multiaddr[] = [];
let foundNodePeerId: PeerId | undefined = undefined;
const doesPeerIdExistInResponse =
peerInfos.find(({ ENR }) => {
foundNodeMas = ENR?.peerInfo?.multiaddrs ?? [];
foundNodePeerId = ENR?.peerInfo?.id;
return ENR?.peerInfo?.id.toString() === nwaku1PeerId.toString();
}) !== undefined;
const foundNodeMultiaddrs: Multiaddr[] = [];
const foundNodePeerId: PeerId | undefined = undefined;
const doesPeerIdExistInResponse = peerInfos.some(
({ ENR }) => ENR?.peerInfo?.id.toString() === nwaku1PeerId.toString()
);

if (!foundNodePeerId) {
throw new Error("Peer ID not found");
}

expect(doesPeerIdExistInResponse).to.be.equal(true);

await waku.libp2p.dialProtocol(foundNodeMas, PeerExchangeCodec);
await waku.libp2p.dialProtocol(foundNodeMultiaddrs, PeerExchangeCodec);
await waitForRemotePeerWithCodec(
waku,
PeerExchangeCodec,
Expand Down

0 comments on commit 0cd283a

Please sign in to comment.