From 4da56a1b5125c5b415453a624f42dfc74f966f79 Mon Sep 17 00:00:00 2001 From: Carlos Santos <4a.santos@gmail.com> Date: Tue, 15 Apr 2025 11:13:30 +0200 Subject: [PATCH] backend: Replace hardcoded autoDeletionDate calculation with ms library --- backend/tests/integration/api/rooms/get-room.test.ts | 3 ++- backend/tests/integration/api/rooms/get-rooms.test.ts | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/backend/tests/integration/api/rooms/get-room.test.ts b/backend/tests/integration/api/rooms/get-room.test.ts index f4adb8a..fd99fde 100644 --- a/backend/tests/integration/api/rooms/get-room.test.ts +++ b/backend/tests/integration/api/rooms/get-room.test.ts @@ -1,5 +1,6 @@ import { describe, it, expect, beforeAll, afterAll, afterEach } from '@jest/globals'; import { createRoom, deleteAllRooms, startTestServer, stopTestServer, getRoom } from '../../../utils/helpers.js'; +import ms from 'ms'; describe('OpenVidu Meet Room API Tests', () => { beforeAll(async () => { @@ -103,7 +104,7 @@ describe('OpenVidu Meet Room API Tests', () => { it('should retrieve a room with autoDeletionDate', async () => { // Use validAutoDeletionDate that's defined in the test file or create here - const validAutoDeletionDate = Date.now() + 2 * 60 * 60 * 1000; // 2 hours ahead + const validAutoDeletionDate = Date.now() + ms('2h'); // Create a room with autoDeletionDate const createdRoom = await createRoom({ diff --git a/backend/tests/integration/api/rooms/get-rooms.test.ts b/backend/tests/integration/api/rooms/get-rooms.test.ts index 84a1891..3213a34 100644 --- a/backend/tests/integration/api/rooms/get-rooms.test.ts +++ b/backend/tests/integration/api/rooms/get-rooms.test.ts @@ -8,9 +8,10 @@ import { stopTestServer, assertSuccessRoomsResponse } from '../../../utils/helpers.js'; +import ms from 'ms'; describe('OpenVidu Meet Room API Tests', () => { - const validAutoDeletionDate = Date.now() + 2 * 60 * 60 * 1000; // 2 hours ahead + const validAutoDeletionDate = Date.now() + ms('2h'); beforeAll(async () => { await startTestServer();