Create promises before dialing
This commit is contained in:
parent
ea49955412
commit
04690b553a
|
@ -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");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue