Merge pull request #37 from status-im/fix-tests

This commit is contained in:
Franck Royer 2021-10-06 13:54:22 +11:00 committed by GitHub
commit b4479ee3a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 10 deletions

View File

@ -32,15 +32,7 @@ describe("Messenger", () => {
}), }),
]); ]);
dbg("Connect messengers"); const pubsubPromises = [
// Connect both messengers together for test purposes
messengerAlice.waku.addPeerToAddressBook(
messengerBob.waku.libp2p.peerId,
messengerBob.waku.libp2p.multiaddrs
);
dbg("Wait for pubsub connection");
await Promise.all([
new Promise((resolve) => new Promise((resolve) =>
messengerAlice.waku.libp2p.pubsub.once( messengerAlice.waku.libp2p.pubsub.once(
"pubsub:subscription-change", "pubsub:subscription-change",
@ -52,7 +44,17 @@ describe("Messenger", () => {
resolve(null) resolve(null)
) )
), ),
]); ];
dbg("Connect messengers");
// Connect both messengers together for test purposes
messengerAlice.waku.addPeerToAddressBook(
messengerBob.waku.libp2p.peerId,
messengerBob.waku.libp2p.multiaddrs
);
dbg("Wait for pubsub connection");
await Promise.all(pubsubPromises);
dbg("Messengers ready"); dbg("Messengers ready");
}); });