mirror of
https://github.com/status-im/js-waku.git
synced 2025-02-22 09:58:10 +00:00
Replace delay by waiting on correct event
This commit is contained in:
parent
eb874a956b
commit
b7ce121955
@ -20,12 +20,13 @@ test('Publishes message', async (t) => {
|
||||
await node1.dial(node2.peerId);
|
||||
|
||||
await wakuRelayNode1.subscribe();
|
||||
await new Promise((resolve) =>
|
||||
node2.pubsub.once('pubsub:subscription-change', (...args) => resolve(args))
|
||||
);
|
||||
|
||||
// Setup the promise before publishing to ensure the event is not missed
|
||||
const promise = waitForNextData(node1.pubsub);
|
||||
|
||||
await delay(500);
|
||||
|
||||
await wakuRelayNode2.publish(message);
|
||||
|
||||
const node1Received = await promise;
|
||||
|
Loading…
x
Reference in New Issue
Block a user