From 818a8256e7a0998f5926d1d95296981e9cc2e1c5 Mon Sep 17 00:00:00 2001 From: Franck Royer Date: Tue, 20 Apr 2021 10:34:23 +1000 Subject: [PATCH] Wait for identify protocol to finish --- src/lib/waku_relay/index.spec.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/lib/waku_relay/index.spec.ts b/src/lib/waku_relay/index.spec.ts index 816ac19010..67492c9057 100644 --- a/src/lib/waku_relay/index.spec.ts +++ b/src/lib/waku_relay/index.spec.ts @@ -270,6 +270,16 @@ describe('Waku Relay', () => { waku2.dial(nimWakuMultiaddr), ]); + // Wait for identify protocol to finish + await Promise.all([ + new Promise((resolve) => + waku1.libp2p.peerStore.once('change:protocols', resolve) + ), + new Promise((resolve) => + waku2.libp2p.peerStore.once('change:protocols', resolve) + ), + ]); + await Promise.all([ new Promise((resolve) => waku1.libp2p.pubsub.once('gossipsub:heartbeat', resolve)