mirror of
https://github.com/logos-messaging/js-waku.git
synced 2026-01-09 17:23:11 +00:00
When playing around with tests frameworks, it was noticed that noise was using entropy that lead to handles remaining open at the end of the test run.
45 lines
1.2 KiB
TypeScript
45 lines
1.2 KiB
TypeScript
import { expect } from 'chai';
|
|
|
|
import { NOISE_KEY_1 } from '../test_utils/constants';
|
|
import { NimWaku } from '../test_utils/nim_waku';
|
|
|
|
import Waku from './waku';
|
|
import { CODEC } from './waku_relay';
|
|
|
|
describe('Waku', function () {
|
|
describe('Interop: Nim', function () {
|
|
it('nim connects to js', async function () {
|
|
this.timeout(10_000);
|
|
const waku = await Waku.create(NOISE_KEY_1);
|
|
|
|
const peerId = waku.libp2p.peerId.toB58String();
|
|
|
|
const localMultiaddr = waku.libp2p.multiaddrs.find((addr) =>
|
|
addr.toString().match(/127\.0\.0\.1/)
|
|
);
|
|
const multiAddrWithId = localMultiaddr + '/p2p/' + peerId;
|
|
|
|
const nimWaku = new NimWaku(this.test!.title);
|
|
await nimWaku.start({ staticnode: multiAddrWithId });
|
|
|
|
const nimPeers = await nimWaku.peers();
|
|
|
|
expect(nimPeers).to.deep.equal([
|
|
{
|
|
multiaddr: multiAddrWithId,
|
|
protocol: CODEC,
|
|
connected: true,
|
|
},
|
|
]);
|
|
|
|
const nimPeerId = await nimWaku.getPeerId();
|
|
const jsPeers = waku.libp2p.peerStore.peers;
|
|
|
|
expect(jsPeers.has(nimPeerId.toB58String())).to.be.true;
|
|
|
|
nimWaku.stop();
|
|
await waku.stop();
|
|
});
|
|
});
|
|
});
|