diff --git a/packages/tests/src/teardown.ts b/packages/tests/src/teardown.ts index c4605d9c43..e68782999e 100644 --- a/packages/tests/src/teardown.ts +++ b/packages/tests/src/teardown.ts @@ -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 { - 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 () => { diff --git a/packages/tests/tests/filter/multiple_pubsub.node.spec.ts b/packages/tests/tests/filter/multiple_pubsub.node.spec.ts index 724afeba2f..dd0ed193fd 100644 --- a/packages/tests/tests/filter/multiple_pubsub.node.spec.ts +++ b/packages/tests/tests/filter/multiple_pubsub.node.spec.ts @@ -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 () { diff --git a/packages/tests/tests/filter/ping.node.spec.ts b/packages/tests/tests/filter/ping.node.spec.ts index 5b1e4abc38..843133e5d8 100644 --- a/packages/tests/tests/filter/ping.node.spec.ts +++ b/packages/tests/tests/filter/ping.node.spec.ts @@ -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 () { diff --git a/packages/tests/tests/filter/push.node.spec.ts b/packages/tests/tests/filter/push.node.spec.ts index b04bf68011..69be141025 100644 --- a/packages/tests/tests/filter/push.node.spec.ts +++ b/packages/tests/tests/filter/push.node.spec.ts @@ -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) => { diff --git a/packages/tests/tests/filter/subscribe.node.spec.ts b/packages/tests/tests/filter/subscribe.node.spec.ts index 8fde8bd217..ebb2f072a8 100644 --- a/packages/tests/tests/filter/subscribe.node.spec.ts +++ b/packages/tests/tests/filter/subscribe.node.spec.ts @@ -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 () { diff --git a/packages/tests/tests/filter/unsubscribe.node.spec.ts b/packages/tests/tests/filter/unsubscribe.node.spec.ts index 61a3f85b5e..b79d3e313e 100644 --- a/packages/tests/tests/filter/unsubscribe.node.spec.ts +++ b/packages/tests/tests/filter/unsubscribe.node.spec.ts @@ -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 () { diff --git a/packages/tests/tests/light-push/index.node.spec.ts b/packages/tests/tests/light-push/index.node.spec.ts index 84e8d606e2..4e47a4b451 100644 --- a/packages/tests/tests/light-push/index.node.spec.ts +++ b/packages/tests/tests/light-push/index.node.spec.ts @@ -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) => { diff --git a/packages/tests/tests/light-push/multiple_pubsub.node.spec.ts b/packages/tests/tests/light-push/multiple_pubsub.node.spec.ts index 49d1573cb1..05f8f5068a 100644 --- a/packages/tests/tests/light-push/multiple_pubsub.node.spec.ts +++ b/packages/tests/tests/light-push/multiple_pubsub.node.spec.ts @@ -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 () { diff --git a/packages/tests/tests/store/cursor.node.spec.ts b/packages/tests/tests/store/cursor.node.spec.ts index d823492374..7b7b5343d5 100644 --- a/packages/tests/tests/store/cursor.node.spec.ts +++ b/packages/tests/tests/store/cursor.node.spec.ts @@ -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); diff --git a/packages/tests/tests/store/error_handling.node.spec.ts b/packages/tests/tests/store/error_handling.node.spec.ts index 286f32b77c..37fa6d8971 100644 --- a/packages/tests/tests/store/error_handling.node.spec.ts +++ b/packages/tests/tests/store/error_handling.node.spec.ts @@ -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 () { diff --git a/packages/tests/tests/store/index.node.spec.ts b/packages/tests/tests/store/index.node.spec.ts index 44f3fb023a..964151a637 100644 --- a/packages/tests/tests/store/index.node.spec.ts +++ b/packages/tests/tests/store/index.node.spec.ts @@ -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 () { diff --git a/packages/tests/tests/store/multiple_pubsub.spec.ts b/packages/tests/tests/store/multiple_pubsub.spec.ts index 48a0d39fb4..f64e80be7e 100644 --- a/packages/tests/tests/store/multiple_pubsub.spec.ts +++ b/packages/tests/tests/store/multiple_pubsub.spec.ts @@ -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 () { diff --git a/packages/tests/tests/store/order.node.spec.ts b/packages/tests/tests/store/order.node.spec.ts index 4b5db460ca..98f34b4bcb 100644 --- a/packages/tests/tests/store/order.node.spec.ts +++ b/packages/tests/tests/store/order.node.spec.ts @@ -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) => { diff --git a/packages/tests/tests/store/page_size.node.spec.ts b/packages/tests/tests/store/page_size.node.spec.ts index cad9496412..4f1b466a10 100644 --- a/packages/tests/tests/store/page_size.node.spec.ts +++ b/packages/tests/tests/store/page_size.node.spec.ts @@ -25,7 +25,7 @@ describe("Waku Store, page size", function () { afterEach(async function () { this.timeout(15000); - await tearDownNodes([nwaku], [waku]); + await tearDownNodes(nwaku, waku); }); [ diff --git a/packages/tests/tests/store/sorting.node.spec.ts b/packages/tests/tests/store/sorting.node.spec.ts index e4c7c1be5b..b7d232cec6 100644 --- a/packages/tests/tests/store/sorting.node.spec.ts +++ b/packages/tests/tests/store/sorting.node.spec.ts @@ -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) => { diff --git a/packages/tests/tests/store/time_filter.node.spec.ts b/packages/tests/tests/store/time_filter.node.spec.ts index a56cb54e28..f53ff23b8f 100644 --- a/packages/tests/tests/store/time_filter.node.spec.ts +++ b/packages/tests/tests/store/time_filter.node.spec.ts @@ -24,7 +24,7 @@ describe("Waku Store, time filter", function () { afterEach(async function () { this.timeout(15000); - await tearDownNodes([nwaku], [waku]); + await tearDownNodes(nwaku, waku); }); [