diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2021-08-25 16:04:14 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-25 16:04:14 -0400 |
commit | 5d7d9d64434bd0a9f1fcf391dabc51693e8cf1ae (patch) | |
tree | c217fac5a7d67ba326d456b2973d23a7c7b151d4 /cli/tests/unit/performance_test.ts | |
parent | 66476efec5b92cd04c161d82cbb69992fed4eb0a (diff) |
chore(tests): improve unit tests using `deferred` (#11842)
Diffstat (limited to 'cli/tests/unit/performance_test.ts')
-rw-r--r-- | cli/tests/unit/performance_test.ts | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/cli/tests/unit/performance_test.ts b/cli/tests/unit/performance_test.ts index 989d221d8..7ea1720a5 100644 --- a/cli/tests/unit/performance_test.ts +++ b/cli/tests/unit/performance_test.ts @@ -11,12 +11,14 @@ import { unitTest({ perms: { hrtime: false } }, async function performanceNow() { const resolvable = deferred(); const start = performance.now(); + let totalTime = 0; setTimeout(() => { const end = performance.now(); - assert(end - start >= 10); + totalTime = end - start; resolvable.resolve(); }, 10); await resolvable; + assert(totalTime >= 10); }); unitTest(function performanceMark() { |