logos-messaging-js/src/lib/waku.spec.ts
fryorcraken.eth 889ec4d45c
feat: split bootstrap logic
Split the bootstrap logic in 2 different classes that implement the
libp2p peer discovery class.

This enables better tree shaking when not using the heaviest version
(DNS Discovery).

It also means using libp2p interface directly when customizing the peer
discovery logic.

Finally, the `default` method is still available via the
`defaultBootstrap` option.
2022-08-07 12:03:05 +10:00

44 lines
1.1 KiB
TypeScript

import type { PeerId } from "@libp2p/interface-peer-id";
import { expect } from "chai";
import { createWaku } from "./create_waku";
import { Waku } from "./waku";
describe("Waku Dial", function () {
describe("Bootstrap [live data]", function () {
let waku: Waku;
afterEach(function () {
!!waku && waku.stop().catch((e) => console.log("Waku failed to stop", e));
});
before(function () {
if (process.env.CI) {
this.skip();
}
});
it("Enabling default [live data]", async function () {
// This test depends on fleets.status.im being online.
// This dependence must be removed once DNS discovery is implemented
this.timeout(20_000);
waku = await createWaku({
defaultBootstrap: true,
});
await waku.start();
const connectedPeerID: PeerId = await new Promise((resolve) => {
waku.libp2p.connectionManager.addEventListener(
"peer:connect",
(evt) => {
resolve(evt.detail.remotePeer);
}
);
});
expect(connectedPeerID).to.not.be.undefined;
});
});
});