backend: Replace hardcoded autoDeletionDate calculation with ms library

This commit is contained in:
Carlos Santos 2025-04-15 11:13:30 +02:00
parent a449e2a41a
commit 4da56a1b51
2 changed files with 4 additions and 2 deletions

View File

@ -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({

View File

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