Template
1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo synced 2024-11-29 13:16:10 +01:00

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:
Earl Warren 2024-07-03 18:36:22 +00:00
commit 51363f383d

View file

@ -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();
}