From 98b7d58b019259faa7ea5a24b08cc7dfee348b79 Mon Sep 17 00:00:00 2001 From: Arseniy Terekhin Date: Sat, 11 May 2024 19:45:29 +0300 Subject: [PATCH] test: make `debounce` decorator test more stable --- src/test/suite/utilitiesSuite.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/test/suite/utilitiesSuite.ts b/src/test/suite/utilitiesSuite.ts index 7586a77..9d9fe50 100644 --- a/src/test/suite/utilitiesSuite.ts +++ b/src/test/suite/utilitiesSuite.ts @@ -175,16 +175,18 @@ function decoratorsSuite(this: Suite) { } const dt = new DebounceTest(); + assert.equal(fakeTimers.countTimers(), 0); const p0 = dt.debounced_method(); + assert.equal(fakeTimers.countTimers(), 1); const p1 = dt.debounced_method(); const p2 = dt.debounced_method(); const resPromise = Promise.race([p0, p1, p2]); - assert.equal(await resPromise, undefined); assert.equal(fakeTimers.countTimers(), 1); const debounceTimer = await fakeTimers.nextAsync(); + assert.equal(fakeTimers.countTimers(), 0); + assert.equal(await resPromise, undefined); assert.equal(debounceTimer, startTimeStamp + 50, 'main timer worked'); assert.equal(dt.debounce_count, 1, 'reached main timer only'); - assert.equal(fakeTimers.countTimers(), 0); }); }