diff --git a/backend/tests/integration/api/recordings/delete-recording.test.ts b/backend/tests/integration/api/recordings/delete-recording.test.ts index 9c719bb..b3c2d37 100644 --- a/backend/tests/integration/api/recordings/delete-recording.test.ts +++ b/backend/tests/integration/api/recordings/delete-recording.test.ts @@ -1,6 +1,7 @@ import { afterAll, beforeAll, beforeEach, describe, expect, it } from '@jest/globals'; import { container } from '../../../../src/config'; import { MeetStorageService } from '../../../../src/services'; +import { MeetRoom } from '../../../../src/typings/ce'; import { expectValidationError, expectValidStartRecordingResponse } from '../../../helpers/assertion-helpers'; import { deleteAllRecordings, @@ -12,7 +13,6 @@ import { stopRecording } from '../../../helpers/request-helpers'; import { setupMultiRecordingsTestContext } from '../../../helpers/test-scenarios'; -import { MeetRoom } from '../../../../src/typings/ce'; describe('Recording API Tests', () => { beforeAll(() => { diff --git a/backend/tests/integration/api/recordings/garbage-collector.test.ts b/backend/tests/integration/api/recordings/garbage-collector.test.ts index 2da5599..3e091f0 100644 --- a/backend/tests/integration/api/recordings/garbage-collector.test.ts +++ b/backend/tests/integration/api/recordings/garbage-collector.test.ts @@ -1,18 +1,17 @@ import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it, jest } from '@jest/globals'; +import { EgressInfo, EgressStatus, Room } from 'livekit-server-sdk'; import ms from 'ms'; +import { Lock } from 'redlock'; +import { container } from '../../../../src/config/index.js'; +import INTERNAL_CONFIG from '../../../../src/config/internal-config.js'; import { MeetLock } from '../../../../src/helpers/index.js'; import { - RecordingService, - MutexService, LiveKitService, LoggerService, + MutexService, + RecordingService, RedisLock } from '../../../../src/services/index.js'; - -import { container } from '../../../../src/config/dependency-injector.config.js'; -import { EgressInfo, EgressStatus, Room } from 'livekit-server-sdk'; -import INTERNAL_CONFIG from '../../../../src/config/internal-config.js'; -import { Lock } from 'redlock'; import { startTestServer } from '../../../helpers/request-helpers.js'; describe('Recording Garbage Collector Tests', () => { diff --git a/backend/tests/integration/api/recordings/get-media-recording.test.ts b/backend/tests/integration/api/recordings/get-media-recording.test.ts index 0302709..a551bb4 100644 --- a/backend/tests/integration/api/recordings/get-media-recording.test.ts +++ b/backend/tests/integration/api/recordings/get-media-recording.test.ts @@ -1,4 +1,5 @@ import { afterAll, beforeAll, describe, expect, it } from '@jest/globals'; +import { MeetRoom } from '../../../../src/typings/ce'; import { expectSuccessRecordingMediaResponse, expectValidationError } from '../../../helpers/assertion-helpers'; import { deleteAllRecordings, @@ -9,7 +10,6 @@ import { stopRecording } from '../../../helpers/request-helpers'; import { setupMultiRecordingsTestContext } from '../../../helpers/test-scenarios'; -import { MeetRoom } from '../../../../src/typings/ce'; describe('Recording API Tests', () => { let room: MeetRoom, recordingId: string, moderatorCookie: string; @@ -27,6 +27,7 @@ describe('Recording API Tests', () => { await stopAllRecordings(moderatorCookie); await Promise.all([deleteAllRecordings(), deleteAllRooms()]); }); + describe('Recording Media Tests', () => { it('should return 200 when requesting the full media content', async () => { const response = await getRecordingMedia(recordingId); @@ -157,7 +158,7 @@ describe('Recording API Tests', () => { // Request a range beyond the file size const response = await getRecordingMedia(recordingId, `bytes=${fullSize + 1}-${fullSize + 1000}`); expect(response.status).toBe(416); - expect(response.body).toHaveProperty('name', 'Recording Error'); + expect(response.body).toHaveProperty('error', 'Recording Error'); expect(response.body).toHaveProperty('message'); expect(response.body.message).toContain(`Recording '${recordingId}' range not satisfiable`); expect(response.body.message).toMatch(/File size: \d+/); @@ -170,7 +171,7 @@ describe('Recording API Tests', () => { // Attempt to get the media of an active recording const response = await getRecordingMedia(activeRecordingId); expect(response.status).toBe(409); - expect(response.body).toHaveProperty('name', 'Recording Error'); + expect(response.body).toHaveProperty('error', 'Recording Error'); expect(response.body).toHaveProperty('message'); expect(response.body.message).toContain(`Recording '${activeRecordingId}' is not stopped yet`); diff --git a/backend/tests/integration/api/recordings/get-recording.test.ts b/backend/tests/integration/api/recordings/get-recording.test.ts index 34cafd4..49a1cfc 100644 --- a/backend/tests/integration/api/recordings/get-recording.test.ts +++ b/backend/tests/integration/api/recordings/get-recording.test.ts @@ -1,4 +1,7 @@ import { afterAll, beforeAll, describe, expect, it } from '@jest/globals'; +import { errorRecordingNotFound } from '../../../../src/models/error.model.js'; +import { MeetRecordingStatus, MeetRoom } from '../../../../src/typings/ce/index.js'; +import { expectValidationError, expectValidGetRecordingResponse } from '../../../helpers/assertion-helpers.js'; import { deleteAllRecordings, deleteAllRooms, @@ -7,11 +10,6 @@ import { startTestServer, stopAllRecordings } from '../../../helpers/request-helpers.js'; - -import { errorRecordingNotFound } from '../../../../src/models/error.model.js'; -import { MeetRecordingStatus } from '../../../../src/typings/ce/recording.model.js'; -import { MeetRoom } from '../../../../src/typings/ce/room.js'; -import { expectValidationError, expectValidGetRecordingResponse } from '../../../helpers/assertion-helpers.js'; import { setupMultiRecordingsTestContext, TestContext } from '../../../helpers/test-scenarios.js'; describe('Recording API Tests', () => { diff --git a/backend/tests/integration/api/recordings/get-recordings.test.ts b/backend/tests/integration/api/recordings/get-recordings.test.ts index 8be44b8..c671374 100644 --- a/backend/tests/integration/api/recordings/get-recordings.test.ts +++ b/backend/tests/integration/api/recordings/get-recordings.test.ts @@ -1,4 +1,11 @@ -import { describe, it, expect, beforeAll, afterEach, afterAll } from '@jest/globals'; +import { afterAll, afterEach, beforeAll, describe, expect, it } from '@jest/globals'; +import { MeetRecordingInfo, MeetRecordingStatus, MeetRoom } from '../../../../src/typings/ce/index.js'; +import { + expectSuccessListRecordingResponse, + expectValidationError, + expectValidRecording, + expectValidRecordingWithFields +} from '../../../helpers/assertion-helpers.js'; import { deleteAllRecordings, deleteAllRooms, @@ -6,16 +13,7 @@ import { getAllRecordings, startTestServer } from '../../../helpers/request-helpers.js'; - -import { - expectValidationError, - expectSuccessListRecordingResponse, - expectValidRecordingWithFields, - expectValidRecording -} from '../../../helpers/assertion-helpers.js'; import { RoomData, setupMultiRecordingsTestContext, TestContext } from '../../../helpers/test-scenarios.js'; -import { MeetRoom } from '../../../../src/typings/ce/room.js'; -import { MeetRecordingInfo, MeetRecordingStatus } from '../../../../src/typings/ce/recording.model.js'; describe('Recordings API Tests', () => { let context: TestContext | null = null; diff --git a/backend/tests/integration/api/recordings/race-conditions.test.ts b/backend/tests/integration/api/recordings/race-conditions.test.ts index 751ad06..4bcf085 100644 --- a/backend/tests/integration/api/recordings/race-conditions.test.ts +++ b/backend/tests/integration/api/recordings/race-conditions.test.ts @@ -1,35 +1,34 @@ -import { describe, it, expect, beforeAll, afterAll, afterEach, jest } from '@jest/globals'; - +import { afterEach, beforeAll, describe, expect, it, jest } from '@jest/globals'; +import { container } from '../../../../src/config/index.js'; +import { RecordingService, TaskSchedulerService } from '../../../../src/services'; +import { + expectValidStartRecordingResponse, + expectValidStopRecordingResponse +} from '../../../helpers/assertion-helpers'; import { eventController } from '../../../helpers/event-controller'; import { - startRecording, - sleep, + bulkDeleteRecordings, deleteAllRecordings, deleteAllRooms, - startTestServer, - stopRecording, - stopAllRecordings, - getRecordingMedia, deleteRecording, - bulkDeleteRecordings + getRecordingMedia, + sleep, + startRecording, + startTestServer, + stopAllRecordings, + stopRecording } from '../../../helpers/request-helpers'; - import { setupMultiRecordingsTestContext, setupMultiRoomTestContext, TestContext } from '../../../helpers/test-scenarios'; -import { - expectValidStartRecordingResponse, - expectValidStopRecordingResponse -} from '../../../helpers/assertion-helpers'; -import { RecordingService, TaskSchedulerService } from '../../../../src/services'; -import { container } from '../../../../src/config/dependency-injector.config'; describe('Recording API Race Conditions Tests', () => { let context: TestContext | null = null; let recordingService: RecordingService; let taskSchedulerService: TaskSchedulerService; + beforeAll(async () => { startTestServer(); recordingService = container.get(RecordingService); @@ -48,8 +47,6 @@ describe('Recording API Race Conditions Tests', () => { jest.clearAllMocks(); }); - afterAll(async () => {}); - it('should start recordings concurrently in two rooms and stop one before RECORDING_ACTIVE is received for the other', async () => { context = await setupMultiRoomTestContext(2, true); const roomDataA = context.getRoomByIndex(0); diff --git a/backend/tests/integration/api/recordings/start-recording.test.ts b/backend/tests/integration/api/recordings/start-recording.test.ts index b0117db..623f49a 100644 --- a/backend/tests/integration/api/recordings/start-recording.test.ts +++ b/backend/tests/integration/api/recordings/start-recording.test.ts @@ -1,5 +1,13 @@ import { afterAll, afterEach, beforeAll, describe, expect, it } from '@jest/globals'; import { setInternalConfig } from '../../../../src/config/internal-config.js'; +import { errorRoomNotFound } from '../../../../src/models/error.model.js'; +import { MeetRoom } from '../../../../src/typings/ce/index.js'; +import { + expectValidationError, + expectValidRecordingLocationHeader, + expectValidStartRecordingResponse, + expectValidStopRecordingResponse +} from '../../../helpers/assertion-helpers.js'; import { deleteAllRecordings, deleteAllRooms, @@ -10,15 +18,6 @@ import { stopAllRecordings, stopRecording } from '../../../helpers/request-helpers.js'; - -import { errorRoomNotFound } from '../../../../src/models/error.model.js'; -import { MeetRoom } from '../../../../src/typings/ce/room.js'; -import { - expectValidationError, - expectValidRecordingLocationHeader, - expectValidStartRecordingResponse, - expectValidStopRecordingResponse -} from '../../../helpers/assertion-helpers.js'; import { setupMultiRoomTestContext, TestContext } from '../../../helpers/test-scenarios.js'; describe('Recording API Tests', () => { @@ -117,7 +116,7 @@ describe('Recording API Tests', () => { const response = await startRecording(room.roomId, moderatorCookie); // Room exists but it has no participants expect(response.status).toBe(409); - expect(response.body.message).toContain(`The room '${room.roomId}' has no participants`); + expect(response.body.message).toContain(`Room '${room.roomId}' has no participants`); }); it('should sanitize roomId and reject the request with 409 due to no participants', async () => { @@ -126,7 +125,7 @@ describe('Recording API Tests', () => { console.log('Response:', response.body); expect(response.status).toBe(409); - expect(response.body.message).toContain(`The room '${room.roomId}' has no participants`); + expect(response.body.message).toContain(`Room '${room.roomId}' has no participants`); }); it('should reject request with roomId that becomes empty after sanitization', async () => { @@ -152,7 +151,7 @@ describe('Recording API Tests', () => { const error = errorRoomNotFound('non-existing-room-id'); expect(response.status).toBe(404); expect(response.body).toEqual({ - name: error.name, + error: error.name, message: error.message }); }); diff --git a/backend/tests/integration/api/recordings/stop-recording.test.ts b/backend/tests/integration/api/recordings/stop-recording.test.ts index 05576b8..ef387a0 100644 --- a/backend/tests/integration/api/recordings/stop-recording.test.ts +++ b/backend/tests/integration/api/recordings/stop-recording.test.ts @@ -1,15 +1,15 @@ -import { describe, it, expect, beforeAll, afterAll } from '@jest/globals'; -import { expectValidStopRecordingResponse, expectErrorResponse } from '../../../helpers/assertion-helpers'; +import { afterAll, beforeAll, describe, expect, it } from '@jest/globals'; +import { MeetRoom } from '../../../../src/typings/ce'; +import { expectErrorResponse, expectValidStopRecordingResponse } from '../../../helpers/assertion-helpers'; import { - startRecording, - disconnectFakeParticipants, - stopAllRecordings, - stopRecording, deleteAllRecordings, deleteAllRooms, - startTestServer + disconnectFakeParticipants, + startRecording, + startTestServer, + stopAllRecordings, + stopRecording } from '../../../helpers/request-helpers'; -import { MeetRoom } from '../../../../src/typings/ce'; import { setupMultiRoomTestContext, TestContext } from '../../../helpers/test-scenarios'; describe('Recording API Tests', () => { @@ -19,6 +19,7 @@ describe('Recording API Tests', () => { beforeAll(async () => { startTestServer(); }); + afterAll(async () => { await stopAllRecordings(moderatorCookie); await disconnectFakeParticipants(); @@ -67,7 +68,7 @@ describe('Recording API Tests', () => { it('should return 404 when recordingId does not exist', async () => { const response = await stopRecording(`${room.roomId}--EG_123--444`, moderatorCookie); expect(response.status).toBe(404); - expect(response.body.name).toBe('Recording Error'); + expect(response.body.error).toBe('Recording Error'); expect(response.body.message).toContain('not found'); }); diff --git a/backend/tests/integration/api/rooms/bulk-delete-rooms.test.ts b/backend/tests/integration/api/rooms/bulk-delete-rooms.test.ts index fda7702..7054530 100644 --- a/backend/tests/integration/api/rooms/bulk-delete-rooms.test.ts +++ b/backend/tests/integration/api/rooms/bulk-delete-rooms.test.ts @@ -130,7 +130,7 @@ describe('Room API Tests', () => { expect(response.status).toBe(202); - expect(response.body.message).toContain(`Rooms ${room1.roomId}, ${room2.roomId} marked for deletion`); + expect(response.body.message).toContain(`Rooms '${room1.roomId}, ${room2.roomId}' marked for deletion`); expect(response.body.deleted).toBeUndefined(); // Verify that the rooms are marked for deletion diff --git a/backend/tests/integration/api/rooms/create-room.test.ts b/backend/tests/integration/api/rooms/create-room.test.ts index 7f982e2..06f8e5e 100644 --- a/backend/tests/integration/api/rooms/create-room.test.ts +++ b/backend/tests/integration/api/rooms/create-room.test.ts @@ -187,7 +187,7 @@ describe('Room API Tests', () => { .expect(400); expect(response.body.error).toContain('Bad Request'); - expect(response.body.message).toContain('Malformed Body'); + expect(response.body.message).toContain('Malformed body'); }); it('should fail when roomIdPrefix is too long', async () => {