1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-11-24 08:57:03 -05:00

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:
Earl Warren 2024-07-03 17:12:27 +00:00
commit a6756ed3b8

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