mirror of
https://github.com/logos-messaging/logos-messaging-js.git
synced 2026-01-21 09:23:12 +00:00
44 lines
1.1 KiB
TypeScript
44 lines
1.1 KiB
TypeScript
import { expect } from 'chai';
|
|
|
|
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();
|
|
|
|
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();
|
|
});
|
|
});
|
|
});
|