mirror of
https://github.com/status-im/js-waku.git
synced 2025-02-24 10:58:18 +00:00
fix: peer-exchange go-waku interop (#1300)
* merge: master * fix: CI * use: js script instead of shell script to run precheck and mocha * check for peer id instead of ws multiaddr in response
This commit is contained in:
parent
306e38ba14
commit
b7d4b675bd
@ -9,11 +9,9 @@ const WAKUNODE_IMAGE =
|
|||||||
async function main() {
|
async function main() {
|
||||||
try {
|
try {
|
||||||
await execAsync(`docker inspect ${WAKUNODE_IMAGE}`);
|
await execAsync(`docker inspect ${WAKUNODE_IMAGE}`);
|
||||||
|
|
||||||
console.log("Using local image");
|
console.log("Using local image");
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log("Pulling image...");
|
console.log("Pulling image...");
|
||||||
|
|
||||||
await execAsync(`docker pull ${WAKUNODE_IMAGE}`);
|
await execAsync(`docker pull ${WAKUNODE_IMAGE}`);
|
||||||
console.log("Image pulled");
|
console.log("Image pulled");
|
||||||
}
|
}
|
||||||
|
@ -92,7 +92,7 @@ describe("Peer Exchange", () => {
|
|||||||
discv5BootstrapNode: enr,
|
discv5BootstrapNode: enr,
|
||||||
});
|
});
|
||||||
|
|
||||||
const nwaku1Ma = await nwaku1.getMultiaddrWithId();
|
const nwaku1PeerId = await nwaku1.getPeerId();
|
||||||
const nwaku2Ma = await nwaku2.getMultiaddrWithId();
|
const nwaku2Ma = await nwaku2.getMultiaddrWithId();
|
||||||
|
|
||||||
waku = await createLightNode();
|
waku = await createLightNode();
|
||||||
@ -130,14 +130,12 @@ describe("Peer Exchange", () => {
|
|||||||
expect(peerInfos.length).to.be.lessThanOrEqual(numPeersToRequest);
|
expect(peerInfos.length).to.be.lessThanOrEqual(numPeersToRequest);
|
||||||
expect(peerInfos[0].ENR).to.not.be.null;
|
expect(peerInfos[0].ENR).to.not.be.null;
|
||||||
|
|
||||||
const doesMultiaddrExist =
|
const doesPeerIdExistInResponse =
|
||||||
peerInfos.find(
|
peerInfos.find(
|
||||||
(peerInfo) =>
|
({ ENR }) => ENR?.peerInfo?.id.toString() === nwaku1PeerId.toString()
|
||||||
peerInfo.ENR?.getFullMultiaddrs()?.find((multiaddr) =>
|
|
||||||
multiaddr.equals(nwaku1Ma)
|
|
||||||
) !== undefined
|
|
||||||
) !== undefined;
|
) !== undefined;
|
||||||
expect(doesMultiaddrExist).to.be.equal(true);
|
|
||||||
|
expect(doesPeerIdExistInResponse).to.be.equal(true);
|
||||||
|
|
||||||
expect(waku.libp2p.peerStore.has(await nwaku2.getPeerId())).to.be.true;
|
expect(waku.libp2p.peerStore.has(await nwaku2.getPeerId())).to.be.true;
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user