Wait for identify protocol to finish

This commit is contained in:
Franck Royer 2021-04-20 10:34:23 +10:00
parent 00e303ee0a
commit 818a8256e7
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
1 changed files with 10 additions and 0 deletions

View File

@ -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)