Merge pull request 'test(js): false negative in sleep test' (#4285) from earl-warren/forgejo:wip-js-utils into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4285 Reviewed-by: Beowulf <beowulf@noreply.codeberg.org>
This commit is contained in:
commit
a6756ed3b8
1 changed files with 1 additions and 5 deletions
|
@ -177,10 +177,6 @@ test('serializeXml', () => {
|
|||
});
|
||||
|
||||
test('sleep', async () => {
|
||||
// Test 500 ms sleep
|
||||
await testSleep(500);
|
||||
|
||||
// Test 2000 ms sleep
|
||||
await testSleep(2000);
|
||||
});
|
||||
|
||||
|
@ -189,5 +185,5 @@ async function testSleep(ms) {
|
|||
await sleep(ms);
|
||||
const endTime = Date.now(); // Record the end time
|
||||
const actualSleepTime = endTime - startTime;
|
||||
expect(Math.abs(actualSleepTime - ms) <= 15).toBeTruthy();
|
||||
expect(actualSleepTime >= ms).toBeTruthy();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue