test: Increase timeouts + add debug logs

This commit is contained in:
Franck Royer 2021-09-01 15:49:46 +10:00
parent cfb97b6bde
commit 50fb533e44
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
1 changed files with 8 additions and 1 deletions

View File

@ -29,6 +29,9 @@ describe('Waku Relay', () => {
let waku1: Waku;
let waku2: Waku;
beforeEach(async function () {
this.timeout(10000);
log('Starting JS Waku instances');
[waku1, waku2] = await Promise.all([
Waku.create({ staticNoiseKey: NOISE_KEY_1 }),
Waku.create({
@ -36,9 +39,10 @@ describe('Waku Relay', () => {
libp2p: { addresses: { listen: ['/ip4/0.0.0.0/tcp/0/ws'] } },
}),
]);
log("Instances started, adding waku2 to waku1's address book");
waku1.addPeerToAddressBook(waku2.libp2p.peerId, waku2.libp2p.multiaddrs);
log('Wait for mutual pubsub subscription');
await Promise.all([
new Promise((resolve) =>
waku1.libp2p.pubsub.once('pubsub:subscription-change', () =>
@ -51,6 +55,7 @@ describe('Waku Relay', () => {
)
),
]);
log('before each hook done');
});
afterEach(async function () {
@ -60,11 +65,13 @@ describe('Waku Relay', () => {
});
it('Subscribe', async function () {
log('Getting subscribers');
const subscribers1 =
waku1.libp2p.pubsub.getSubscribers(DefaultPubSubTopic);
const subscribers2 =
waku2.libp2p.pubsub.getSubscribers(DefaultPubSubTopic);
log('Asserting mutual subscription');
expect(subscribers1).to.contain(waku2.libp2p.peerId.toB58String());
expect(subscribers2).to.contain(waku1.libp2p.peerId.toB58String());
});