Skip to content

Commit

Permalink
fix: test refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
danisharora099 committed Jan 11, 2024
1 parent 7a6e0a9 commit 079ccb6
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions packages/tests/tests/peer_exchange.node.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,17 @@ describe("Peer Exchange", () => {
expect(peerInfos[0].ENR).to.not.be.null;
expect(peerInfos[0].ENR?.peerInfo?.multiaddrs).to.not.be.null;

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

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

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

0 comments on commit 079ccb6

Please sign in to comment.