diff --git a/src/lib/waku.browser.spec.ts b/src/lib/waku.browser.spec.ts new file mode 100644 index 0000000000..c27b68474b --- /dev/null +++ b/src/lib/waku.browser.spec.ts @@ -0,0 +1,29 @@ +import { expect } from 'chai'; + +import { NOISE_KEY_1, NOISE_KEY_2 } from '../test_utils/'; + +import { Waku } from './waku'; + +describe('Waku Dial', function () { + it('js connects to js', async function () { + this.timeout(10_000); + const [waku1, waku2] = await Promise.all([ + Waku.create({ + staticNoiseKey: NOISE_KEY_1, + libp2p: { addresses: { listen: ['/ip4/0.0.0.0/tcp/0/ws'] } }, + }), + Waku.create({ staticNoiseKey: NOISE_KEY_2 }), + ]); + const waku1MultiAddrWithId = waku1.getLocalMultiaddrWithID(); + + await waku2.dial(waku1MultiAddrWithId); + + const waku2PeerId = waku2.libp2p.peerId; + + const waku1Peers = waku1.libp2p.peerStore.peers; + + expect(waku1Peers.has(waku2PeerId.toB58String())).to.be.true; + + await Promise.all([waku1.stop(), waku2.stop()]); + }); +}); diff --git a/src/lib/waku.spec.ts b/src/lib/waku.spec.ts index eaa2025843..83ab8208ba 100644 --- a/src/lib/waku.spec.ts +++ b/src/lib/waku.spec.ts @@ -1,39 +1,12 @@ import { expect } from 'chai'; import TCP from 'libp2p-tcp'; -import { - makeLogFileName, - NimWaku, - NOISE_KEY_1, - NOISE_KEY_2, -} from '../test_utils/'; +import { makeLogFileName, NimWaku, NOISE_KEY_1 } from '../test_utils/'; import { Waku } from './waku'; import { RelayCodec } from './waku_relay'; describe('Waku Dial', function () { - it('js connects to js', async function () { - this.timeout(10_000); - const [waku1, waku2] = await Promise.all([ - Waku.create({ - staticNoiseKey: NOISE_KEY_1, - libp2p: { addresses: { listen: ['/ip4/0.0.0.0/tcp/0/ws'] } }, - }), - Waku.create({ staticNoiseKey: NOISE_KEY_2 }), - ]); - const waku1MultiAddrWithId = waku1.getLocalMultiaddrWithID(); - - await waku2.dial(waku1MultiAddrWithId); - - const waku2PeerId = waku2.libp2p.peerId; - - const waku1Peers = waku1.libp2p.peerStore.peers; - - expect(waku1Peers.has(waku2PeerId.toB58String())).to.be.true; - - await Promise.all([waku1.stop(), waku2.stop()]); - }); - describe('Interop: Nim', function () { it('nim connects to js', async function () { this.timeout(10_000);