From 31140d0b59c2a83ef4d3971b8b3a3782f361c4bb Mon Sep 17 00:00:00 2001 From: DIYgod Date: Sun, 25 Feb 2024 00:34:52 +0800 Subject: [PATCH] test: wait --- test/utils/wait.js => lib/utils/wait.test.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) rename test/utils/wait.js => lib/utils/wait.test.ts (58%) diff --git a/test/utils/wait.js b/lib/utils/wait.test.ts similarity index 58% rename from test/utils/wait.js rename to lib/utils/wait.test.ts index f005dcda21..07e49c0b32 100644 --- a/test/utils/wait.js +++ b/lib/utils/wait.test.ts @@ -1,12 +1,13 @@ -const wait = require('../../lib/utils/wait'); +import { describe, expect, it } from '@jest/globals'; +import wait from '@/utils/wait'; describe('wait', () => { it('wait 0.1 second', async () => { - const startDate = new Date(); + const startDate = Date.now(); await wait(0.1 * 1000); - const endDate = new Date(); + const endDate = Date.now(); expect(endDate - startDate).toBeGreaterThan(90); expect(endDate - startDate).toBeLessThan(150); });