From 10c32c84c86232d346c2e98b87de1289accbf91a Mon Sep 17 00:00:00 2001 From: Franck Royer Date: Tue, 14 Jun 2022 17:04:40 +1000 Subject: [PATCH] test: add delay for filter un/subscribe --- src/lib/waku_filter/index.node.spec.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/lib/waku_filter/index.node.spec.ts b/src/lib/waku_filter/index.node.spec.ts index 25bf8d1707..f02949e018 100644 --- a/src/lib/waku_filter/index.node.spec.ts +++ b/src/lib/waku_filter/index.node.spec.ts @@ -46,6 +46,10 @@ describe("Waku Filter", () => { expect(msg.payloadAsUtf8).to.eq(messageText); }; await waku.filter.subscribe(callback, [TestContentTopic]); + // As the filter protocol does not cater for a ack of subscription + // we cannot know whether the subscription happened. Something we want to + // correct in future versions of the protocol. + await delay(200); const message = await WakuMessage.fromUtf8String( messageText, TestContentTopic @@ -66,6 +70,7 @@ describe("Waku Filter", () => { expect(msg.contentTopic).to.eq(TestContentTopic); }; await waku.filter.subscribe(callback, [TestContentTopic]); + await delay(200); await waku.lightPush.push( await WakuMessage.fromUtf8String("Filtering works!", TestContentTopic) ); @@ -89,6 +94,7 @@ describe("Waku Filter", () => { const unsubscribe = await waku.filter.subscribe(callback, [ TestContentTopic, ]); + await delay(200); await waku.lightPush.push( await WakuMessage.fromUtf8String( "This should be received", @@ -97,6 +103,7 @@ describe("Waku Filter", () => { ); await delay(100); await unsubscribe(); + await delay(200); await waku.lightPush.push( await WakuMessage.fromUtf8String( "This should not be received",