-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(processes):
waitForExpectedResult
helper (#461)
- Loading branch information
1 parent
3c09818
commit 7e08d59
Showing
23 changed files
with
483 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { test } from '../../../src/modules/test.js'; | ||
import { assert } from '../../../src/modules/assert.js'; | ||
import { sleep } from '../../../src/modules/wait-for.js'; | ||
|
||
test('Sleep "mini" helper', async () => { | ||
const startTime = Date.now(); | ||
const delay = 500; | ||
await sleep(delay); | ||
const elapsedTime = Date.now() - startTime; | ||
const margin = 250; | ||
|
||
assert.ok( | ||
elapsedTime >= delay - margin && elapsedTime <= delay + margin, | ||
`Expected sleep time to be around ${delay}ms (±${margin}ms), but was ${elapsedTime}ms` | ||
); | ||
}); |
Oops, something went wrong.