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