Skip to content

Commit

Permalink
Subscription before each & renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
SionoiS committed Sep 19, 2023
1 parent 15ed826 commit ff30fd6
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 34 deletions.
2 changes: 1 addition & 1 deletion packages/tests/src/node/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ export class NimGoNode {
return this.rpcCall<RpcInfoResponse>("get_waku_v2_debug_v1_info", []);
}

async sendSubscriptions(
async ensureSubscriptions(
pubsubTopics: [string] = [DefaultPubSubTopic]
): Promise<boolean> {
this.checkProcess();
Expand Down
12 changes: 0 additions & 12 deletions packages/tests/tests/filter/subscribe.node.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@ describe("Waku Filter V2: Subscribe", function () {
});

it("Subscribe and receive messages via lightPush", async function () {
// Nwaku subscribe to the default pubsub topic
await nwaku.sendSubscriptions();

await subscription.subscribe([TestDecoder], messageCollector.callback);

await waku.lightPush.send(TestEncoder, messagePayload);
Expand All @@ -64,9 +61,6 @@ describe("Waku Filter V2: Subscribe", function () {
});

it("Subscribe and receive messages via waku relay post", async function () {
// Nwaku subscribe to the default pubsub topic
await nwaku.sendSubscriptions();

await subscription.subscribe([TestDecoder], messageCollector.callback);

await delay(400);
Expand All @@ -87,9 +81,6 @@ describe("Waku Filter V2: Subscribe", function () {
});

it("Subscribe and receive 2 messages on the same topic", async function () {
// Nwaku subscribe to the default pubsub topic
await nwaku.sendSubscriptions();

await subscription.subscribe([TestDecoder], messageCollector.callback);

await waku.lightPush.send(TestEncoder, messagePayload);
Expand All @@ -114,9 +105,6 @@ describe("Waku Filter V2: Subscribe", function () {
});

it("Subscribe and receive messages on 2 different content topics", async function () {
// Nwaku subscribe to the default pubsub topic
await nwaku.sendSubscriptions();

// Subscribe to the first content topic and send a message.
await subscription.subscribe([TestDecoder], messageCollector.callback);
await waku.lightPush.send(TestEncoder, messagePayload);
Expand Down
18 changes: 0 additions & 18 deletions packages/tests/tests/filter/unsubscribe.node.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ describe("Waku Filter V2: Unsubscribe", function () {
});

it("Unsubscribe 1 topic - node subscribed to 1 topic", async function () {
// Nwaku subscribe to the default pubsub topic
await nwaku.sendSubscriptions();

await subscription.subscribe([TestDecoder], messageCollector.callback);
await waku.lightPush.send(TestEncoder, messagePayload);
expect(await messageCollector.waitForMessages(1)).to.eq(true);
Expand All @@ -56,9 +53,6 @@ describe("Waku Filter V2: Unsubscribe", function () {
});

it("Unsubscribe 1 topic - node subscribed to 2 topics", async function () {
// Nwaku subscribe to the default pubsub topic
await nwaku.sendSubscriptions();

// Subscribe to 2 topics and send messages
await subscription.subscribe([TestDecoder], messageCollector.callback);
const newContentTopic = "/test/2/waku-filter";
Expand All @@ -81,9 +75,6 @@ describe("Waku Filter V2: Unsubscribe", function () {
});

it("Unsubscribe 2 topics - node subscribed to 2 topics", async function () {
// Nwaku subscribe to the default pubsub topic
await nwaku.sendSubscriptions();

// Subscribe to 2 topics and send messages
await subscription.subscribe([TestDecoder], messageCollector.callback);
const newContentTopic = "/test/2/waku-filter";
Expand All @@ -106,9 +97,6 @@ describe("Waku Filter V2: Unsubscribe", function () {
});

it("Unsubscribe topics the node is not subscribed to", async function () {
// Nwaku subscribe to the default pubsub topic
await nwaku.sendSubscriptions();

// Subscribe to 1 topic and send message
await subscription.subscribe([TestDecoder], messageCollector.callback);
await waku.lightPush.send(TestEncoder, { payload: utf8ToBytes("M1") });
Expand All @@ -128,9 +116,6 @@ describe("Waku Filter V2: Unsubscribe", function () {
});

it("Unsubscribes all - node subscribed to 1 topic", async function () {
// Nwaku subscribe to the default pubsub topic
await nwaku.sendSubscriptions();

await subscription.subscribe([TestDecoder], messageCollector.callback);
await waku.lightPush.send(TestEncoder, { payload: utf8ToBytes("M1") });
expect(await messageCollector.waitForMessages(1)).to.eq(true);
Expand All @@ -147,9 +132,6 @@ describe("Waku Filter V2: Unsubscribe", function () {
});

it("Unsubscribes all - node subscribed to 10 topics", async function () {
// Nwaku subscribe to the default pubsub topic
await nwaku.sendSubscriptions();

// Subscribe to 10 topics and send message
const topicCount = 10;
const td = generateTestData(topicCount);
Expand Down
6 changes: 3 additions & 3 deletions packages/tests/tests/relay.node.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,9 @@ describe("Waku Relay [node only]", () => {

await waku.dial(await nwaku.getMultiaddrWithId());
await waitForRemotePeer(waku, [Protocols.Relay]);

// Nwaku subscribe to the default pubsub topic
await nwaku.ensureSubscriptions();
});

afterEach(async function () {
Expand All @@ -437,9 +440,6 @@ describe("Waku Relay [node only]", () => {
it("Publishes to nwaku", async function () {
this.timeout(30000);

// Nwaku subscribe to the default pubsub topic
await nwaku.sendSubscriptions();

const messageText = "This is a message";
await waku.relay.send(TestEncoder, { payload: utf8ToBytes(messageText) });

Expand Down

0 comments on commit ff30fd6

Please sign in to comment.