Ensure relay peers are available before starting the test (#431)

This commit is contained in:
Franck R 2022-01-24 14:41:45 +11:00 committed by GitHub
parent 1f0f96e66f
commit 199a3c7218
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 8 deletions

View File

@ -41,10 +41,11 @@ describe('Waku Message [node only]', function () {
await waku.dial(await nimWaku.getMultiaddrWithId());
await waku.waitForConnectedPeer([RelayCodecs]);
// Wait for one heartbeat to ensure mesh is updated
await new Promise((resolve) =>
waku.libp2p.pubsub.once('gossipsub:heartbeat', resolve)
);
let peers = await waku.relay.getPeers();
while (peers.size === 0) {
await delay(200);
peers = await waku.relay.getPeers();
}
});
afterEach(async function () {
@ -53,8 +54,7 @@ describe('Waku Message [node only]', function () {
});
it('JS decrypts nim message [asymmetric, no signature]', async function () {
this.timeout(10000);
await delay(200);
this.timeout(5000);
const messageText = 'Here is an encrypted message.';
const message: WakuRelayMessage = {
@ -114,8 +114,7 @@ describe('Waku Message [node only]', function () {
});
it('JS decrypts nim message [symmetric, no signature]', async function () {
this.timeout(10000);
await delay(200);
this.timeout(5000);
const messageText = 'Here is a message encrypted in a symmetric manner.';
const message: WakuRelayMessage = {