improve teardown nodes

This commit is contained in:
fbarbu15 2023-10-10 09:03:44 +03:00
parent 1d1c7a28a8
commit c9389e3d07
No known key found for this signature in database
GPG Key ID: D75221C8DEA22501
16 changed files with 23 additions and 20 deletions

View File

@ -7,10 +7,13 @@ import { NimGoNode } from "./index.js";
const log = debug("waku:test");
export async function tearDownNodes(
nwakuNodes: NimGoNode[],
wakuNodes: LightNode[]
nwakuNodes: NimGoNode | NimGoNode[],
wakuNodes: LightNode | LightNode[]
): Promise<void> {
const stopNwakuNodes = nwakuNodes.map(async (nwaku) => {
const nNodes = Array.isArray(nwakuNodes) ? nwakuNodes : [nwakuNodes];
const wNodes = Array.isArray(wakuNodes) ? wakuNodes : [wakuNodes];
const stopNwakuNodes = nNodes.map(async (nwaku) => {
if (nwaku) {
await pRetry(
async () => {
@ -26,7 +29,7 @@ export async function tearDownNodes(
}
});
const stopWakuNodes = wakuNodes.map(async (waku) => {
const stopWakuNodes = wNodes.map(async (waku) => {
if (waku) {
await pRetry(
async () => {

View File

@ -51,7 +51,7 @@ describe("Waku Filter V2: Multiple PubSubtopics", function () {
this.afterEach(async function () {
this.timeout(15000);
await tearDownNodes([nwaku, nwaku2], [waku]);
await tearDownNodes([nwaku, nwaku2], waku);
});
it("Subscribe and receive messages on custom pubsubtopic", async function () {

View File

@ -30,7 +30,7 @@ describe("Waku Filter V2: Ping", function () {
this.afterEach(async function () {
this.timeout(15000);
await tearDownNodes([nwaku], [waku]);
await tearDownNodes(nwaku, waku);
});
it("Ping on subscribed peer", async function () {

View File

@ -38,7 +38,7 @@ describe("Waku Filter V2: FilterPush", function () {
this.afterEach(async function () {
this.timeout(15000);
await tearDownNodes([nwaku], [waku]);
await tearDownNodes(nwaku, waku);
});
TEST_STRING.forEach((testItem) => {

View File

@ -49,7 +49,7 @@ describe("Waku Filter V2: Subscribe", function () {
this.afterEach(async function () {
this.timeout(15000);
await tearDownNodes([nwaku, nwaku2], [waku]);
await tearDownNodes([nwaku, nwaku2], waku);
});
it("Subscribe and receive messages via lightPush", async function () {

View File

@ -35,7 +35,7 @@ describe("Waku Filter V2: Unsubscribe", function () {
this.afterEach(async function () {
this.timeout(15000);
await tearDownNodes([nwaku], [waku]);
await tearDownNodes(nwaku, waku);
});
it("Unsubscribe 1 topic - node subscribed to 1 topic", async function () {

View File

@ -36,7 +36,7 @@ describe("Waku Light Push", function () {
this.afterEach(async function () {
this.timeout(15000);
await tearDownNodes([nwaku], [waku]);
await tearDownNodes(nwaku, waku);
});
TEST_STRING.forEach((testItem) => {

View File

@ -48,7 +48,7 @@ describe("Waku Light Push : Multiple PubSubtopics", function () {
this.afterEach(async function () {
this.timeout(15000);
await tearDownNodes([nwaku, nwaku2], [waku]);
await tearDownNodes([nwaku, nwaku2], waku);
});
it("Push message on custom pubSubTopic", async function () {

View File

@ -29,7 +29,7 @@ describe("Waku Store, cursor", function () {
afterEach(async function () {
this.timeout(15000);
await tearDownNodes([nwaku], [waku, waku2]);
await tearDownNodes(nwaku, [waku, waku2]);
});
[
@ -169,7 +169,7 @@ describe("Waku Store, cursor", function () {
}
});
it("Passing cursor with wrong pubSubTopic", async function () {
it.only("Passing cursor with wrong pubSubTopic", async function () {
await sendMessages(nwaku, totalMsgs, TestContentTopic, DefaultPubSubTopic);
waku = await startAndConnectLightNode(nwaku);

View File

@ -27,7 +27,7 @@ describe("Waku Store, error handling", function () {
afterEach(async function () {
this.timeout(15000);
await tearDownNodes([nwaku], [waku]);
await tearDownNodes(nwaku, waku);
});
it("Query Generator, Wrong PubSubTopic", async function () {

View File

@ -60,7 +60,7 @@ describe("Waku Store, general", function () {
afterEach(async function () {
this.timeout(15000);
await tearDownNodes([nwaku], [waku, waku2]);
await tearDownNodes(nwaku, [waku, waku2]);
});
it("Query generator for multiple messages", async function () {

View File

@ -41,7 +41,7 @@ describe("Waku Store, custom pubsub topic", function () {
afterEach(async function () {
this.timeout(15000);
await tearDownNodes([nwaku, nwaku2], [waku]);
await tearDownNodes([nwaku, nwaku2], waku);
});
it("Generator, custom pubsub topic", async function () {

View File

@ -27,7 +27,7 @@ describe("Waku Store, order", function () {
afterEach(async function () {
this.timeout(15000);
await tearDownNodes([nwaku], [waku]);
await tearDownNodes(nwaku, waku);
});
[PageDirection.FORWARD, PageDirection.BACKWARD].forEach((pageDirection) => {

View File

@ -25,7 +25,7 @@ describe("Waku Store, page size", function () {
afterEach(async function () {
this.timeout(15000);
await tearDownNodes([nwaku], [waku]);
await tearDownNodes(nwaku, waku);
});
[

View File

@ -25,7 +25,7 @@ describe("Waku Store, sorting", function () {
afterEach(async function () {
this.timeout(15000);
await tearDownNodes([nwaku], [waku]);
await tearDownNodes(nwaku, waku);
});
[PageDirection.FORWARD, PageDirection.BACKWARD].forEach((pageDirection) => {

View File

@ -24,7 +24,7 @@ describe("Waku Store, time filter", function () {
afterEach(async function () {
this.timeout(15000);
await tearDownNodes([nwaku], [waku]);
await tearDownNodes(nwaku, waku);
});
[