From b2632af04b8124f333c88c73a46116391ae769e5 Mon Sep 17 00:00:00 2001 From: Franck Royer Date: Tue, 16 Mar 2021 13:45:18 +1100 Subject: [PATCH] Remove fixed time delays --- src/lib/node.spec.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/lib/node.spec.ts b/src/lib/node.spec.ts index b129c5b876..7a504f8e62 100644 --- a/src/lib/node.spec.ts +++ b/src/lib/node.spec.ts @@ -2,7 +2,6 @@ import test from 'ava'; import Libp2p from 'libp2p'; import Pubsub from 'libp2p-interfaces/src/pubsub'; -import { delay } from '../test_utils/delay'; import { NimWaku } from '../test_utils/nim_waku'; import { createNode } from './node'; @@ -145,14 +144,14 @@ test('Nim-interop: nim node sends message to js node', async (t) => { await wakuRelayNode.subscribe(); - await delay(3000); + await new Promise((resolve) => + node.pubsub.once('gossipsub:heartbeat', resolve) + ); const receivedPromise = waitForNextData(node.pubsub); await nimWaku.sendMessage(message); - await delay(3000); - const receivedMsg = await receivedPromise; t.is(receivedMsg.contentTopic, message.contentTopic);