Pass truly async function to getPeers, remove TODO (#428)

* Pass truly async function to `getPeers`

* Confirmed nim-waku's RPC API only returned managed peers
This commit is contained in:
Franck R 2022-01-24 18:46:06 +11:00 committed by GitHub
parent 41b7ef17e1
commit e0949dab04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -29,8 +29,6 @@ describe('Waku Dial [node only]', function () {
waku ? await waku.stop() : null; waku ? await waku.stop() : null;
}); });
// TODO: Clarify whether nwaku's `get_waku_v2_admin_v1_peers` can be expected
// to return peers with inbound connections.
it.skip('js connects to nim', async function () { it.skip('js connects to nim', async function () {
this.timeout(20_000); this.timeout(20_000);
nimWaku = new NimWaku(makeLogFileName(this)); nimWaku = new NimWaku(makeLogFileName(this));
@ -119,13 +117,12 @@ describe('Waku Dial [node only]', function () {
nimWaku = new NimWaku(makeLogFileName(this)); nimWaku = new NimWaku(makeLogFileName(this));
await nimWaku.start(); await nimWaku.start();
const multiAddrWithId = await nimWaku.getMultiaddrWithId();
waku = await Waku.create({ waku = await Waku.create({
staticNoiseKey: NOISE_KEY_1, staticNoiseKey: NOISE_KEY_1,
bootstrap: { bootstrap: {
getPeers: async () => { getPeers: async () => {
return [multiAddrWithId]; return [await nimWaku.getMultiaddrWithId()];
}, },
}, },
}); });
@ -136,6 +133,7 @@ describe('Waku Dial [node only]', function () {
}); });
}); });
const multiAddrWithId = await nimWaku.getMultiaddrWithId();
expect(connectedPeerID.toB58String()).to.eq(multiAddrWithId.getPeerId()); expect(connectedPeerID.toB58String()).to.eq(multiAddrWithId.getPeerId());
}); });
}); });