js-waku/packages/tests/tests/waku.node.optional.spec.ts
Florin Barbu 347cbfa08a
chore: run tests in parallel (#1655)
* run tests in parallel

* small fixes

* small fixes

* fix setup of nodes

* fix relay tests

* fix Static Sharding: Running Nodes tests

* try with 5 threads

* try with 6 threads

* use startWithRetries as default start

* revert to 6

* set 10 jobs

* revert to back to 6

* add CI info in readme
2023-10-13 12:36:43 +03:00

56 lines
1.5 KiB
TypeScript

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, tearDownNodes } from "../src/index.js";
describe("Use static and several ENR trees for bootstrap", function () {
let waku: LightNode;
let nwaku: NimGoNode;
afterEach(async function () {
this.timeout(15000);
await tearDownNodes(nwaku, waku);
});
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.not.be.undefined;
});
});