Merge pull request #12 from status-im/ci-timeout

This commit is contained in:
Franck Royer 2021-10-05 13:52:42 +11:00 committed by GitHub
commit 3a204c9ad4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View File

@ -17,4 +17,4 @@ jobs:
node-version: 14.x node-version: 14.x
- run: yarn install --frozen-lockfile - run: yarn install --frozen-lockfile
- run: yarn build - run: yarn build
- run: yarn test - run: DEBUG=communities:test* yarn test

View File

@ -1,4 +1,5 @@
import { expect } from "chai"; import { expect } from "chai";
import debug from "debug";
import { utils } from "js-waku"; import { utils } from "js-waku";
import { ApplicationMetadataMessage } from "./application_metadata_message"; import { ApplicationMetadataMessage } from "./application_metadata_message";
@ -7,6 +8,8 @@ import { Messenger } from "./messenger";
const testChatId = "test-chat-id"; const testChatId = "test-chat-id";
const dbg = debug("communities:test:messenger");
describe("Messenger", () => { describe("Messenger", () => {
let messengerAlice: Messenger; let messengerAlice: Messenger;
let messengerBob: Messenger; let messengerBob: Messenger;
@ -16,9 +19,12 @@ describe("Messenger", () => {
beforeEach(async function () { beforeEach(async function () {
this.timeout(10_000); this.timeout(10_000);
dbg("Generate keys");
identityAlice = Identity.generate(); identityAlice = Identity.generate();
identityBob = Identity.generate(); identityBob = Identity.generate();
dbg("Create messengers");
[messengerAlice, messengerBob] = await Promise.all([ [messengerAlice, messengerBob] = await Promise.all([
Messenger.create(identityAlice), Messenger.create(identityAlice),
Messenger.create(identityBob, { Messenger.create(identityBob, {
@ -26,12 +32,14 @@ describe("Messenger", () => {
}), }),
]); ]);
dbg("Connect messengers");
// Connect both messengers together for test purposes // Connect both messengers together for test purposes
messengerAlice.waku.addPeerToAddressBook( messengerAlice.waku.addPeerToAddressBook(
messengerBob.waku.libp2p.peerId, messengerBob.waku.libp2p.peerId,
messengerBob.waku.libp2p.multiaddrs messengerBob.waku.libp2p.multiaddrs
); );
dbg("Wait for pubsub connection");
await Promise.all([ await Promise.all([
new Promise((resolve) => new Promise((resolve) =>
messengerAlice.waku.libp2p.pubsub.once( messengerAlice.waku.libp2p.pubsub.once(
@ -45,6 +53,7 @@ describe("Messenger", () => {
) )
), ),
]); ]);
dbg("Messengers ready");
}); });
it("Sends & Receive public chat messages", async function () { it("Sends & Receive public chat messages", async function () {