fix: explicit nwaku subscriptions in tests (#1572)

* Nwaku subscriptions explicit in tests

* Subscription before each & renaming

* Fix
This commit is contained in:
Simon-Pierre Vivier 2023-09-19 16:45:27 -04:00 committed by GitHub
parent e284c78701
commit 7905aa478b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 0 deletions

View File

@ -209,6 +209,17 @@ export class NimGoNode {
return this.rpcCall<RpcInfoResponse>("get_waku_v2_debug_v1_info", []);
}
async ensureSubscriptions(
pubsubTopics: [string] = [DefaultPubSubTopic]
): Promise<boolean> {
this.checkProcess();
return this.rpcCall<boolean>(
"post_waku_v2_relay_v1_subscriptions",
pubsubTopics
);
}
async sendMessage(
message: MessageRpcQuery,
pubSubTopic: string = DefaultPubSubTopic

View File

@ -42,6 +42,9 @@ describe("Waku Filter V2: Subscribe", function () {
[nwaku, waku] = await runNodes(this);
subscription = await waku.filter.createSubscription();
messageCollector = new MessageCollector(TestContentTopic);
// Nwaku subscribe to the default pubsub topic
await nwaku.ensureSubscriptions();
});
this.afterEach(async function () {

View File

@ -28,6 +28,9 @@ describe("Waku Filter V2: Unsubscribe", function () {
[nwaku, waku] = await runNodes(this);
subscription = await waku.filter.createSubscription();
messageCollector = new MessageCollector(TestContentTopic);
// Nwaku subscribe to the default pubsub topic
await nwaku.ensureSubscriptions();
});
this.afterEach(async function () {

View File

@ -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 () {