test: Add debug logging

This commit is contained in:
Franck Royer 2021-09-27 11:08:14 +10:00
parent e6e8217fc2
commit f1ae5a1639
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
1 changed files with 9 additions and 0 deletions

View File

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