Skip to content

Commit

Permalink
move test to optional file
Browse files Browse the repository at this point in the history
  • Loading branch information
danisharora099 committed Aug 8, 2023
1 parent f8a0b33 commit 2bb5cc9
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 48 deletions.
55 changes: 55 additions & 0 deletions packages/tests/tests/waku.node.optional.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import { bootstrap } from "@libp2p/bootstrap";
import { enrTree, wakuDnsDiscovery } from "@waku/dns-discovery";
import { LightNode } from "@waku/interfaces";
import { createLightNode } from "@waku/sdk";
import { expect } from "chai";

import { makeLogFileName, NimGoNode } from "../src";

describe("Use static and several ENR trees for bootstrap", function () {
let waku: LightNode;
let nwaku: NimGoNode;

afterEach(async function () {
!!nwaku && (await nwaku.stop());
!!waku && waku.stop().catch((e) => console.log("Waku failed to stop", e));
});

it("", async function () {
this.timeout(10_000);

nwaku = new NimGoNode(makeLogFileName(this));
await nwaku.start();
const multiAddrWithId = await nwaku.getMultiaddrWithId();

const NODE_REQUIREMENTS = {
store: 3,
lightPush: 3,
filter: 3,
};

waku = await createLightNode({
libp2p: {
peerDiscovery: [
bootstrap({ list: [multiAddrWithId.toString()] }),
wakuDnsDiscovery(
[enrTree["PROD"], enrTree["TEST"]],
NODE_REQUIREMENTS
),
],
},
});
await waku.start();

const peersDiscovered = await waku.libp2p.peerStore.all();

// 3 from DNS Disc, 1 from bootstrap
expect(peersDiscovered.length).to.eq(3 + 1);
// should also have the bootstrap peer
expect(
peersDiscovered.find(
(p) => p.id.toString() === multiAddrWithId.getPeerId()?.toString()
)
).to.be.true;
});
});
48 changes: 0 additions & 48 deletions packages/tests/tests/waku.node.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,54 +117,6 @@ describe("Waku Dial [node only]", function () {
expect(connectedPeerID.toString()).to.eq(multiAddrWithId.getPeerId());
});
});

describe("Bootstrap + Multiple ENR Trees", function () {
let waku: LightNode;
let nwaku: NimGoNode;

afterEach(async function () {
!!nwaku && (await nwaku.stop());
!!waku && waku.stop().catch((e) => console.log("Waku failed to stop", e));
});

it("", async function () {
this.timeout(10_000);

nwaku = new NimGoNode(makeLogFileName(this));
await nwaku.start();
const multiAddrWithId = await nwaku.getMultiaddrWithId();

const NODE_REQUIREMENTS = {
store: 3,
lightPush: 3,
filter: 3,
};

waku = await createLightNode({
libp2p: {
peerDiscovery: [
bootstrap({ list: [multiAddrWithId.toString()] }),
wakuDnsDiscovery(
[enrTree["PROD"], enrTree["TEST"]],
NODE_REQUIREMENTS
),
],
},
});
await waku.start();

const peersDiscovered = await waku.libp2p.peerStore.all();

// 3 from DNS Disc, 1 from bootstrap
expect(peersDiscovered.length).to.eq(3 + 1);
// should also have the bootstrap peer
expect(
peersDiscovered.find(
(p) => p.id.toString() === multiAddrWithId.getPeerId()?.toString()
)
).to.be.true;
});
});
});

describe("Decryption Keys", () => {
Expand Down

0 comments on commit 2bb5cc9

Please sign in to comment.