diff --git a/src/lib/node.spec.ts b/src/lib/node.spec.ts index a231aba856..9f6b659836 100644 --- a/src/lib/node.spec.ts +++ b/src/lib/node.spec.ts @@ -23,7 +23,6 @@ test('Can publish message', async (t) => { await wakuRelayNode2.subscribe(); // Setup the promise before publishing to ensure the event is not missed - // TODO: Is it possible to import `Message` type? const promise = waitForNextData(node1.pubsub); await delay(500); @@ -63,10 +62,21 @@ test('Nim-waku: nim-waku node connects to js node', async (t) => { const nimWaku = new NimWaku(); await nimWaku.start({ staticnode: multiAddrWithId }); - const peers = await nimWaku.peers(); + const nimPeers = await nimWaku.peers(); - console.log(peers); - t.is(peers.length, 1); + t.deepEqual(nimPeers, [ + { + multiaddr: multiAddrWithId, + protocol: CODEC, + connected: true, + }, + ]); + + const nimAddress = await nimWaku.info().then((info) => info.listenStr); + const nimPeerId = nimAddress.match(/[\d\w]+$/)[0]; + const jsPeers = node.peerStore.peers; + + t.true(jsPeers.has(nimPeerId)); }); function waitForNextData(pubsub: Pubsub): Promise { diff --git a/src/lib/waku_message.spec.ts b/src/lib/waku_message.spec.ts index 0a8abda4a1..6444b81627 100644 --- a/src/lib/waku_message.spec.ts +++ b/src/lib/waku_message.spec.ts @@ -2,8 +2,6 @@ import { fc, testProp } from 'ava-fast-check'; import { Message } from './waku_message'; -// for all a, b, c strings -// b is a substring of a + b + c testProp( 'Waku message round trip binary serialisation', [fc.string()], diff --git a/src/test_utils/nim_waku.ts b/src/test_utils/nim_waku.ts index 4c32d90d86..91ff0fde6d 100644 --- a/src/test_utils/nim_waku.ts +++ b/src/test_utils/nim_waku.ts @@ -40,7 +40,6 @@ export class NimWaku { const logFile = await openAsync(logPath, 'w'); const mergedArgs = argsToArray(mergeArguments(args)); - console.log(mergedArgs); this.process = spawn(NIM_WAKU_BIN, mergedArgs, { cwd: '/home/froyer/src/status-im/nim-waku/', stdio: [ @@ -56,14 +55,13 @@ export class NimWaku { await waitForLine(logPath, 'RPC Server started'); console.log('Nim waku RPC is started'); - console.log(await this.info()); } /** Calls nim-waku2 JSON-RPC API `get_waku_v2_admin_v1_peers` to check * for known peers * @throws if nim-waku2 isn't started. */ - async peers(): Promise { + async peers() { this.checkProcess(); const res = await this.rpcCall('get_waku_v2_admin_v1_peers', []);