Remove fixed time delays

This commit is contained in:
Franck Royer 2021-03-16 13:45:18 +11:00
parent 953aeea053
commit b2632af04b
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
1 changed files with 3 additions and 4 deletions

View File

@ -2,7 +2,6 @@ import test from 'ava';
import Libp2p from 'libp2p'; import Libp2p from 'libp2p';
import Pubsub from 'libp2p-interfaces/src/pubsub'; import Pubsub from 'libp2p-interfaces/src/pubsub';
import { delay } from '../test_utils/delay';
import { NimWaku } from '../test_utils/nim_waku'; import { NimWaku } from '../test_utils/nim_waku';
import { createNode } from './node'; import { createNode } from './node';
@ -145,14 +144,14 @@ test('Nim-interop: nim node sends message to js node', async (t) => {
await wakuRelayNode.subscribe(); await wakuRelayNode.subscribe();
await delay(3000); await new Promise((resolve) =>
node.pubsub.once('gossipsub:heartbeat', resolve)
);
const receivedPromise = waitForNextData(node.pubsub); const receivedPromise = waitForNextData(node.pubsub);
await nimWaku.sendMessage(message); await nimWaku.sendMessage(message);
await delay(3000);
const receivedMsg = await receivedPromise; const receivedMsg = await receivedPromise;
t.is(receivedMsg.contentTopic, message.contentTopic); t.is(receivedMsg.contentTopic, message.contentTopic);