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