Skip to content

Commit 39d766a

Browse files
committed
fix: reduce wait time for sync tests
1 parent 7508907 commit 39d766a

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

packages/sdk/src/reliable_channel/reliable_channel_sync.spec.ts

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ describe("Reliable Channel: Sync", () => {
114114
const mockWakuNodeAlice = new MockWakuNode(commonEventEmitter);
115115
const mockWakuNodeBob = new MockWakuNode(commonEventEmitter);
116116

117-
const syncMinIntervalMs = 1000;
117+
const syncMinIntervalMs = 200;
118118

119119
const reliableChannelAlice = await ReliableChannel.create(
120120
mockWakuNodeAlice,
@@ -166,14 +166,14 @@ describe("Reliable Channel: Sync", () => {
166166
);
167167
// Let's reset the tracker
168168
syncMessageSent = false;
169-
// We should be faster than Bob as Bob will "randomly" wait a full second
169+
// We should be faster than Bob as Bob will "randomly" wait the full interval
170170
await reliableChannelAlice["sendSyncMessage"]();
171171

172-
// Bob should be waiting a full second before sending a message after Alice
173-
await delay(900);
172+
// Bob should be waiting the full interval before sending a message after Alice
173+
await delay(180);
174174

175175
// Now, let's wait Bob to send the sync message
176-
await delay(200);
176+
await delay(40);
177177
expect(syncMessageSent).to.be.true;
178178
});
179179

@@ -184,7 +184,7 @@ describe("Reliable Channel: Sync", () => {
184184
const mockWakuNodeAlice = new MockWakuNode(commonEventEmitter);
185185
const mockWakuNodeBob = new MockWakuNode(commonEventEmitter);
186186

187-
const syncMinIntervalMs = 1000;
187+
const syncMinIntervalMs = 200;
188188

189189
const reliableChannelAlice = await ReliableChannel.create(
190190
mockWakuNodeAlice,
@@ -236,20 +236,20 @@ describe("Reliable Channel: Sync", () => {
236236
);
237237
// Let's reset the tracker
238238
syncMessageSent = false;
239-
// We should be faster than Bob as Bob will "randomly" wait a full second
239+
// We should be faster than Bob as Bob will "randomly" wait the full interval
240240
reliableChannelAlice.send(utf8ToBytes("some message"));
241241

242-
// Bob should be waiting a full second before sending a message after Alice
243-
await delay(900);
242+
// Bob should be waiting the full interval before sending a message after Alice
243+
await delay(180);
244244

245245
// Now, let's wait Bob to send the sync message
246-
await delay(200);
246+
await delay(40);
247247
expect(syncMessageSent).to.be.true;
248248
});
249249

250250
it("Sync message is not sent if another sync message was just sent", async function () {
251251
this.timeout(5000);
252-
const syncMinIntervalMs = 1000;
252+
const syncMinIntervalMs = 200;
253253

254254
const reliableChannel = await ReliableChannel.create(
255255
mockWakuNode,
@@ -287,20 +287,20 @@ describe("Reliable Channel: Sync", () => {
287287
);
288288
// Let's reset the tracker
289289
syncMessageSent = false;
290-
// We should be faster than automated sync as it will "randomly" wait a full second
290+
// We should be faster than automated sync as it will "randomly" wait the full interval
291291
await reliableChannel["sendSyncMessage"]();
292292

293-
// should be waiting a full second before sending a message after Alice
294-
await delay(900);
293+
// should be waiting the full interval before sending a message
294+
await delay(180);
295295

296296
// Now, let's wait to send the automated sync message
297-
await delay(200);
297+
await delay(40);
298298
expect(syncMessageSent).to.be.true;
299299
});
300300

301301
it("Sync message is not sent if another non-ephemeral message was just sent", async function () {
302302
this.timeout(5000);
303-
const syncMinIntervalMs = 1000;
303+
const syncMinIntervalMs = 200;
304304

305305
const reliableChannel = await ReliableChannel.create(
306306
mockWakuNode,
@@ -338,14 +338,14 @@ describe("Reliable Channel: Sync", () => {
338338
);
339339
// Let's reset the tracker
340340
syncMessageSent = false;
341-
// We should be faster than automated sync as it will "randomly" wait a full second
341+
// We should be faster than automated sync as it will "randomly" wait the full interval
342342
reliableChannel.send(utf8ToBytes("non-ephemeral message"));
343343

344-
// should be waiting a full second before sending a message after Alice
345-
await delay(900);
344+
// should be waiting the full interval before sending a message
345+
await delay(180);
346346

347347
// Now, let's wait to send the automated sync message
348-
await delay(200);
348+
await delay(40);
349349
expect(syncMessageSent).to.be.true;
350350
});
351351

0 commit comments

Comments
 (0)