refactor peer exchange compliance test (#1468)

This commit is contained in:
Danish Arora 2023-08-10 11:53:53 +05:30 committed by GitHub
parent 75808ffc9d
commit 462d614701
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 12 deletions

View File

@ -4,7 +4,6 @@ import {
PeerExchangeCodec,
PeerExchangeDiscovery,
WakuPeerExchange,
wakuPeerExchangeDiscovery,
} from "@waku/peer-exchange";
import { createLightNode, Libp2pComponents } from "@waku/sdk";
import { expect } from "chai";
@ -114,21 +113,13 @@ describe("Peer Exchange", () => {
discv5BootstrapNode: enr,
});
waku = await createLightNode({
libp2p: {
peerDiscovery: [wakuPeerExchangeDiscovery()],
},
});
const peerExchange = waku.libp2p.components["components"][
"peer-discovery-0"
] as PeerExchangeDiscovery;
waku = await createLightNode();
await waku.start();
const nwaku2Ma = await nwaku2.getMultiaddrWithId();
const nwaku2Ma = await nwaku2.getMultiaddrWithId();
await waku.libp2p.dialProtocol(nwaku2Ma, PeerExchangeCodec);
return peerExchange;
return new PeerExchangeDiscovery(waku.libp2p.components);
},
teardown: async () => {
await nwaku1?.stop();