test: add delay for filter un/subscribe

This commit is contained in:
Franck Royer 2022-06-14 17:04:40 +10:00 committed by fryorcraken.eth
parent 0564c4f95c
commit 10c32c84c8
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4

View File

@ -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",