diff --git a/backend/tests/integration/api/recordings/bulk-delete-recording.test.ts b/backend/tests/integration/api/recordings/bulk-delete-recording.test.ts index c3f15eb..ff8bd55 100644 --- a/backend/tests/integration/api/recordings/bulk-delete-recording.test.ts +++ b/backend/tests/integration/api/recordings/bulk-delete-recording.test.ts @@ -1,4 +1,7 @@ import { afterAll, beforeAll, describe, expect, it } from '@jest/globals'; +import { container } from '../../../../src/config'; +import { MeetStorageService } from '../../../../src/services'; +import { expectValidationError, expectValidStartRecordingResponse } from '../../../utils/assertion-helpers'; import { bulkDeleteRecordings, deleteAllRecordings, @@ -8,12 +11,9 @@ import { stopRecording } from '../../../utils/helpers'; import { setupMultiRecordingsTestContext } from '../../../utils/test-scenarios'; -import { expectValidationError, expectValidStartRecordingResponse } from '../../../utils/assertion-helpers'; -import { container } from '../../../../src/config/dependency-injector.config'; -import { MeetStorageService } from '../../../../src/services'; describe('Recording API Tests', () => { - beforeAll(async () => { + beforeAll(() => { startTestServer(); }); diff --git a/backend/tests/integration/api/recordings/get-recording.test.ts b/backend/tests/integration/api/recordings/get-recording.test.ts index 7d79509..1b77e20 100644 --- a/backend/tests/integration/api/recordings/get-recording.test.ts +++ b/backend/tests/integration/api/recordings/get-recording.test.ts @@ -1,4 +1,4 @@ -import { describe, it, expect, beforeAll, afterAll } from '@jest/globals'; +import { afterAll, beforeAll, describe, expect, it } from '@jest/globals'; import { deleteAllRecordings, deleteAllRooms, @@ -9,10 +9,10 @@ import { } from '../../../utils/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 '../../../utils/assertion-helpers.js'; import { setupMultiRecordingsTestContext, TestContext } from '../../../utils/test-scenarios.js'; -import { MeetRoom } from '../../../../src/typings/ce/room.js'; -import { MeetRecordingStatus } from '../../../../src/typings/ce/recording.model.js'; describe('Recording API Tests', () => { let context: TestContext | null = null; diff --git a/backend/tests/integration/api/recordings/start-recording.test.ts b/backend/tests/integration/api/recordings/start-recording.test.ts index 1b5bd48..4e9ea62 100644 --- a/backend/tests/integration/api/recordings/start-recording.test.ts +++ b/backend/tests/integration/api/recordings/start-recording.test.ts @@ -1,4 +1,5 @@ -import { describe, it, expect, beforeAll, afterAll, afterEach } from '@jest/globals'; +import { afterAll, afterEach, beforeAll, describe, expect, it } from '@jest/globals'; +import { setInternalConfig } from '../../../../src/config/internal-config.js'; import { deleteAllRecordings, deleteAllRooms, @@ -9,9 +10,9 @@ import { stopAllRecordings, stopRecording } from '../../../utils/helpers.js'; -import { setInternalConfig } from '../../../../src/config/internal-config.js'; import { errorRoomNotFound } from '../../../../src/models/error.model.js'; +import { MeetRoom } from '../../../../src/typings/ce/room.js'; import { expectValidationError, expectValidRecordingLocationHeader, @@ -19,13 +20,12 @@ import { expectValidStopRecordingResponse } from '../../../utils/assertion-helpers.js'; import { setupMultiRoomTestContext, TestContext } from '../../../utils/test-scenarios.js'; -import { MeetRoom } from '../../../../src/typings/ce/room.js'; describe('Recording API Tests', () => { let context: TestContext | null = null; let room: MeetRoom, moderatorCookie: string; - beforeAll(async () => { + beforeAll(() => { startTestServer(); }); 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 e171224..234e678 100644 --- a/backend/tests/integration/api/rooms/bulk-delete-rooms.test.ts +++ b/backend/tests/integration/api/rooms/bulk-delete-rooms.test.ts @@ -1,23 +1,19 @@ -import { describe, it, expect, beforeAll, afterAll, afterEach } from '@jest/globals'; +import { afterEach, beforeAll, describe, expect, it } from '@jest/globals'; import { + bulkDeleteRooms, createRoom, deleteAllRooms, - startTestServer, + disconnectFakeParticipants, getRoom, joinFakeParticipant, - disconnectFakeParticipants, - bulkDeleteRooms + startTestServer } from '../../../utils/helpers.js'; describe('Room API Tests', () => { - beforeAll(async () => { + beforeAll(() => { startTestServer(); }); - afterAll(async () => { - - }); - afterEach(async () => { // Remove all rooms created await disconnectFakeParticipants(); diff --git a/backend/tests/integration/api/rooms/create-room.test.ts b/backend/tests/integration/api/rooms/create-room.test.ts index 2063817..5af4e86 100644 --- a/backend/tests/integration/api/rooms/create-room.test.ts +++ b/backend/tests/integration/api/rooms/create-room.test.ts @@ -1,11 +1,11 @@ -import request from 'supertest'; -import { describe, it, expect, beforeAll, afterAll } from '@jest/globals'; +import { afterAll, beforeAll, describe, expect, it } from '@jest/globals'; import { Express } from 'express'; -import { createRoom, deleteAllRooms, loginUserAsRole, startTestServer } from '../../../utils/helpers.js'; -import { UserRole } from '../../../../src/typings/ce/user.js'; -import INTERNAL_CONFIG from '../../../../src/config/internal-config.js'; import ms from 'ms'; +import request from 'supertest'; +import INTERNAL_CONFIG from '../../../../src/config/internal-config.js'; +import { MeetRecordingAccess, UserRole } from '../../../../src/typings/ce/index.js'; import { expectValidRoom } from '../../../utils/assertion-helpers.js'; +import { createRoom, deleteAllRooms, loginUserAsRole, startTestServer } from '../../../utils/helpers.js'; const ROOMS_PATH = `${INTERNAL_CONFIG.API_BASE_PATH_V1}/rooms`; @@ -46,7 +46,10 @@ describe('Room API Tests', () => { roomIdPrefix: ' =Example Room&/ ', autoDeletionDate: validAutoDeletionDate, preferences: { - recordingPreferences: { enabled: false }, + recordingPreferences: { + enabled: false, + allowAccessTo: MeetRecordingAccess.ADMIN_MODERATOR_PUBLISHER + }, chatPreferences: { enabled: false }, virtualBackgroundPreferences: { enabled: true } } @@ -160,7 +163,10 @@ describe('Room API Tests', () => { roomIdPrefix: 'TestRoom', autoDeletionDate: validAutoDeletionDate, preferences: { - recordingPreferences: { enabled: 'yes' }, // invalid boolean + recordingPreferences: { + enabled: 'yes', // invalid boolean + allowAccessTo: MeetRecordingAccess.ADMIN_MODERATOR_PUBLISHER + }, chatPreferences: { enabled: true }, virtualBackgroundPreferences: { enabled: true } } diff --git a/backend/tests/integration/api/rooms/delete-room.test.ts b/backend/tests/integration/api/rooms/delete-room.test.ts index eb8e32b..b110232 100644 --- a/backend/tests/integration/api/rooms/delete-room.test.ts +++ b/backend/tests/integration/api/rooms/delete-room.test.ts @@ -1,23 +1,21 @@ -import { describe, it, expect, beforeAll, afterAll, afterEach } from '@jest/globals'; +import { afterEach, beforeAll, describe, expect, it } from '@jest/globals'; +import ms from 'ms'; +import { expectValidRoom } from '../../../utils/assertion-helpers.js'; import { createRoom, deleteAllRooms, - startTestServer, - getRoom, deleteRoom, + disconnectFakeParticipants, + getRoom, joinFakeParticipant, - disconnectFakeParticipants + startTestServer } from '../../../utils/helpers.js'; -import ms from 'ms'; -import { expectValidRoom } from '../../../utils/assertion-helpers.js'; describe('Room API Tests', () => { - beforeAll(async () => { + beforeAll(() => { startTestServer(); }); - afterAll(async () => {}); - afterEach(async () => { // Remove all rooms created await disconnectFakeParticipants(); diff --git a/backend/tests/integration/api/rooms/garbage-collector.test.ts b/backend/tests/integration/api/rooms/garbage-collector.test.ts index effde1a..cc6b17a 100644 --- a/backend/tests/integration/api/rooms/garbage-collector.test.ts +++ b/backend/tests/integration/api/rooms/garbage-collector.test.ts @@ -1,30 +1,26 @@ -import { describe, it, expect, beforeAll, afterAll, afterEach } from '@jest/globals'; +import { afterEach, beforeAll, describe, expect, it } from '@jest/globals'; +import ms from 'ms'; +import { setInternalConfig } from '../../../../src/config/internal-config.js'; import { createRoom, deleteAllRooms, - startTestServer, + disconnectFakeParticipants, getRoom, - sleep, + getRooms, joinFakeParticipant, runRoomGarbageCollector, - disconnectFakeParticipants, - getRooms + sleep, + startTestServer } from '../../../utils/helpers.js'; -import ms from 'ms'; -import { setInternalConfig } from '../../../../src/config/internal-config.js'; describe('Room Garbage Collector Tests', () => { - beforeAll(async () => { + beforeAll(() => { setInternalConfig({ MIN_FUTURE_TIME_FOR_ROOM_AUTODELETION_DATE: '0s' }); startTestServer(); }); - afterAll(async () => { - - }); - afterEach(async () => { // Remove all rooms created await deleteAllRooms(); diff --git a/backend/tests/integration/api/rooms/get-room.test.ts b/backend/tests/integration/api/rooms/get-room.test.ts index deab819..0e8ba6f 100644 --- a/backend/tests/integration/api/rooms/get-room.test.ts +++ b/backend/tests/integration/api/rooms/get-room.test.ts @@ -1,20 +1,19 @@ -import { describe, it, expect, beforeAll, afterAll, afterEach } from '@jest/globals'; -import { createRoom, deleteAllRooms, startTestServer, getRoom } from '../../../utils/helpers.js'; +import { afterEach, beforeAll, describe, expect, it } from '@jest/globals'; import ms from 'ms'; +import { MeetRecordingAccess } from '../../../../src/typings/ce/index.js'; import { expectSuccessRoomResponse, expectValidationError, expectValidRoom, expectValidRoomWithFields } from '../../../utils/assertion-helpers.js'; +import { createRoom, deleteAllRooms, getRoom, startTestServer } from '../../../utils/helpers.js'; describe('Room API Tests', () => { - beforeAll(async () => { + beforeAll(() => { startTestServer(); }); - afterAll(async () => {}); - afterEach(async () => { // Remove all rooms created await deleteAllRooms(); @@ -36,7 +35,10 @@ describe('Room API Tests', () => { const payload = { roomIdPrefix: 'custom-prefs', preferences: { - recordingPreferences: { enabled: true }, + recordingPreferences: { + enabled: true, + allowAccessTo: MeetRecordingAccess.ADMIN_MODERATOR_PUBLISHER + }, chatPreferences: { enabled: true }, virtualBackgroundPreferences: { enabled: false } } diff --git a/backend/tests/integration/api/rooms/get-rooms.test.ts b/backend/tests/integration/api/rooms/get-rooms.test.ts index 971b6c8..d37148d 100644 --- a/backend/tests/integration/api/rooms/get-rooms.test.ts +++ b/backend/tests/integration/api/rooms/get-rooms.test.ts @@ -1,25 +1,21 @@ -import { describe, it, beforeAll, afterAll, afterEach } from '@jest/globals'; -import { createRoom, deleteAllRooms, getRooms, startTestServer, } from '../../../utils/helpers.js'; +import { afterEach, beforeAll, describe, it } from '@jest/globals'; import ms from 'ms'; +import { MeetRoom } from '../../../../src/typings/ce/index.js'; import { expectSuccessRoomsResponse, expectValidationError, expectValidRoom, expectValidRoomWithFields } from '../../../utils/assertion-helpers.js'; -import { MeetRoom } from '../../../../src/typings/ce/room.js'; +import { createRoom, deleteAllRooms, getRooms, startTestServer } from '../../../utils/helpers.js'; describe('Room API Tests', () => { const validAutoDeletionDate = Date.now() + ms('2h'); - beforeAll(async () => { + beforeAll(() => { startTestServer(); }); - afterAll(async () => { - - }); - afterEach(async () => { // Remove all rooms created await deleteAllRooms(); diff --git a/backend/tests/integration/api/rooms/update-room.test.ts b/backend/tests/integration/api/rooms/update-room.test.ts index 1a82885..1782edd 100644 --- a/backend/tests/integration/api/rooms/update-room.test.ts +++ b/backend/tests/integration/api/rooms/update-room.test.ts @@ -1,13 +1,12 @@ -import { describe, it, expect, beforeAll, afterAll, afterEach } from '@jest/globals'; -import { createRoom, deleteAllRooms, startTestServer, getRoom, updateRoomPreferences } from '../../../utils/helpers.js'; +import { afterEach, beforeAll, describe, expect, it } from '@jest/globals'; +import { MeetRecordingAccess } from '../../../../src/typings/ce/index.js'; +import { createRoom, deleteAllRooms, getRoom, startTestServer, updateRoomPreferences } from '../../../utils/helpers.js'; describe('Room API Tests', () => { - beforeAll(async () => { + beforeAll(() => { startTestServer(); }); - afterAll(async () => {}); - afterEach(async () => { // Remove all rooms created await deleteAllRooms(); @@ -18,7 +17,10 @@ describe('Room API Tests', () => { const createdRoom = await createRoom({ roomIdPrefix: 'update-test', preferences: { - recordingPreferences: { enabled: true }, + recordingPreferences: { + enabled: true, + allowAccessTo: MeetRecordingAccess.ADMIN_MODERATOR_PUBLISHER + }, chatPreferences: { enabled: true }, virtualBackgroundPreferences: { enabled: true } } @@ -26,7 +28,10 @@ describe('Room API Tests', () => { // Update the room preferences const updatedPreferences = { - recordingPreferences: { enabled: false }, + recordingPreferences: { + enabled: false, + allowAccessTo: MeetRecordingAccess.ADMIN + }, chatPreferences: { enabled: false }, virtualBackgroundPreferences: { enabled: false } }; @@ -49,7 +54,10 @@ describe('Room API Tests', () => { const createdRoom = await createRoom({ roomIdPrefix: 'partial-update', preferences: { - recordingPreferences: { enabled: true }, + recordingPreferences: { + enabled: true, + allowAccessTo: MeetRecordingAccess.ADMIN_MODERATOR_PUBLISHER + }, chatPreferences: { enabled: true }, virtualBackgroundPreferences: { enabled: true } } @@ -57,7 +65,10 @@ describe('Room API Tests', () => { // Update only one preference const partialPreferences = { - recordingPreferences: { enabled: false }, + recordingPreferences: { + enabled: false, + allowAccessTo: MeetRecordingAccess.ADMIN_MODERATOR_PUBLISHER + }, chatPreferences: { enabled: true }, virtualBackgroundPreferences: { enabled: true } }; @@ -83,7 +94,10 @@ describe('Room API Tests', () => { // Invalid preferences (missing required fields) const invalidPreferences = { - recordingPreferences: { enabled: false }, + recordingPreferences: { + enabled: false, + allowAccessTo: MeetRecordingAccess.ADMIN_MODERATOR_PUBLISHER + }, // Missing chatPreferences virtualBackgroundPreferences: { enabled: false } }; @@ -102,7 +116,10 @@ describe('Room API Tests', () => { // Invalid preferences (wrong types) const invalidPreferences = { - recordingPreferences: { enabled: 'true' }, // String instead of boolean + recordingPreferences: { + enabled: 'true', // String instead of boolean + allowAccessTo: MeetRecordingAccess.ADMIN_MODERATOR_PUBLISHER + }, chatPreferences: { enabled: false }, virtualBackgroundPreferences: { enabled: false } }; @@ -131,7 +148,10 @@ describe('Room API Tests', () => { const invalidRoomId = '!@#$%^&*()'; const preferences = { - recordingPreferences: { enabled: false }, + recordingPreferences: { + enabled: false, + allowAccessTo: MeetRecordingAccess.ADMIN_MODERATOR_PUBLISHER + }, chatPreferences: { enabled: false }, virtualBackgroundPreferences: { enabled: false } }; @@ -146,7 +166,10 @@ describe('Room API Tests', () => { const nonExistentRoomId = 'non-existent-room'; const preferences = { - recordingPreferences: { enabled: false }, + recordingPreferences: { + enabled: false, + allowAccessTo: MeetRecordingAccess.ADMIN_MODERATOR_PUBLISHER + }, chatPreferences: { enabled: false }, virtualBackgroundPreferences: { enabled: false } }; diff --git a/backend/tests/integration/api/security/auth.test.ts b/backend/tests/integration/api/security/auth.test.ts index bfe30d4..ef9442e 100644 --- a/backend/tests/integration/api/security/auth.test.ts +++ b/backend/tests/integration/api/security/auth.test.ts @@ -1,21 +1,19 @@ -import request from 'supertest'; -import { describe, it, expect, beforeAll, afterAll } from '@jest/globals'; +import { beforeAll, describe, expect, it } from '@jest/globals'; import { Express } from 'express'; -import { loginUserAsRole, startTestServer } from '../../../utils/helpers.js'; +import request from 'supertest'; import INTERNAL_CONFIG from '../../../../src/config/internal-config.js'; import { UserRole } from '../../../../src/typings/ce/index.js'; +import { loginUserAsRole, startTestServer } from '../../../utils/helpers.js'; const AUTH_PATH = `${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/auth`; describe('Authentication API Tests', () => { let app: Express; - beforeAll(async () => { + beforeAll(() => { app = startTestServer(); }); - afterAll(async () => {}); - describe('Login Tests', () => { it('should successfully login with valid credentials', async () => { const response = await request(app) diff --git a/backend/tests/integration/api/security/meeting-security.test.ts b/backend/tests/integration/api/security/meeting-security.test.ts index c32377b..4f0c778 100644 --- a/backend/tests/integration/api/security/meeting-security.test.ts +++ b/backend/tests/integration/api/security/meeting-security.test.ts @@ -1,11 +1,16 @@ -import request from 'supertest'; -import { describe, it, expect, beforeAll, afterAll } from '@jest/globals'; +import { afterAll, beforeAll, describe, expect, it } from '@jest/globals'; import { Express } from 'express'; -import { createRoom, generateParticipantToken, startTestServer } from '../../../utils/helpers.js'; -import { UserRole } from '../../../../src/typings/ce/index.js'; +import request from 'supertest'; import INTERNAL_CONFIG from '../../../../src/config/internal-config.js'; import { MeetRoomHelper } from '../../../../src/helpers/room.helper.js'; -import { deleteAllRooms, loginUserAsRole } from '../../../utils/helpers.js'; +import { UserRole } from '../../../../src/typings/ce/index.js'; +import { + createRoom, + deleteAllRooms, + generateParticipantToken, + loginUserAsRole, + startTestServer +} from '../../../utils/helpers.js'; const MEETINGS_PATH = `${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/meetings`; diff --git a/backend/tests/integration/api/security/participant-security.test.ts b/backend/tests/integration/api/security/participant-security.test.ts index 32ec65e..6b3a84c 100644 --- a/backend/tests/integration/api/security/participant-security.test.ts +++ b/backend/tests/integration/api/security/participant-security.test.ts @@ -1,11 +1,16 @@ -import request from 'supertest'; -import { describe, it, expect, beforeAll, afterAll } from '@jest/globals'; +import { afterAll, beforeAll, describe, expect, it } from '@jest/globals'; import { Express } from 'express'; -import { createRoom, startTestServer } from '../../../utils/helpers.js'; -import { AuthMode, UserRole } from '../../../../src/typings/ce/index.js'; +import request from 'supertest'; import INTERNAL_CONFIG from '../../../../src/config/internal-config.js'; import { MeetRoomHelper } from '../../../../src/helpers/room.helper.js'; -import { changeSecurityPreferences, deleteAllRooms, loginUserAsRole } from '../../../utils/helpers.js'; +import { AuthMode, UserRole } from '../../../../src/typings/ce/index.js'; +import { + changeSecurityPreferences, + createRoom, + deleteAllRooms, + loginUserAsRole, + startTestServer +} from '../../../utils/helpers.js'; const PARTICIPANTS_PATH = `${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/participants`; diff --git a/backend/tests/integration/api/security/recording-security.test.ts b/backend/tests/integration/api/security/recording-security.test.ts index 1372616..3e37e12 100644 --- a/backend/tests/integration/api/security/recording-security.test.ts +++ b/backend/tests/integration/api/security/recording-security.test.ts @@ -1,6 +1,10 @@ -import request from 'supertest'; -import { describe, it, expect, beforeAll, afterAll } from '@jest/globals'; +import { afterAll, beforeAll, describe, expect, it } from '@jest/globals'; import { Express } from 'express'; +import request from 'supertest'; +import INTERNAL_CONFIG from '../../../../src/config/internal-config.js'; +import { MEET_API_KEY } from '../../../../src/environment.js'; +import { MeetRoomHelper } from '../../../../src/helpers/room.helper.js'; +import { UserRole } from '../../../../src/typings/ce/index.js'; import { createRoom, deleteAllRooms, @@ -8,10 +12,6 @@ import { loginUserAsRole, startTestServer } from '../../../utils/helpers.js'; -import { MEET_API_KEY } from '../../../../src/environment.js'; -import INTERNAL_CONFIG from '../../../../src/config/internal-config.js'; -import { UserRole } from '../../../../src/typings/ce/index.js'; -import { MeetRoomHelper } from '../../../../src/helpers/room.helper.js'; const RECORDINGS_PATH = `${INTERNAL_CONFIG.API_BASE_PATH_V1}/recordings`; const INTERNAL_RECORDINGS_PATH = `${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/recordings`; diff --git a/backend/tests/integration/api/security/room-security.test.ts b/backend/tests/integration/api/security/room-security.test.ts index 2d0569f..129f643 100644 --- a/backend/tests/integration/api/security/room-security.test.ts +++ b/backend/tests/integration/api/security/room-security.test.ts @@ -1,12 +1,18 @@ -import request from 'supertest'; -import { describe, it, expect, beforeAll, beforeEach, afterAll } from '@jest/globals'; +import { afterAll, beforeAll, beforeEach, describe, expect, it } from '@jest/globals'; import { Express } from 'express'; -import { createRoom, generateParticipantToken, startTestServer } from '../../../utils/helpers.js'; -import { AuthMode, UserRole } from '../../../../src/typings/ce/index.js'; -import { MEET_API_KEY } from '../../../../src/environment.js'; +import request from 'supertest'; import INTERNAL_CONFIG from '../../../../src/config/internal-config.js'; +import { MEET_API_KEY } from '../../../../src/environment.js'; import { MeetRoomHelper } from '../../../../src/helpers/room.helper.js'; -import { changeSecurityPreferences, deleteAllRooms, loginUserAsRole } from '../../../utils/helpers.js'; +import { AuthMode, MeetRecordingAccess, UserRole } from '../../../../src/typings/ce/index.js'; +import { + changeSecurityPreferences, + createRoom, + deleteAllRooms, + generateParticipantToken, + loginUserAsRole, + startTestServer +} from '../../../utils/helpers.js'; const ROOMS_PATH = `${INTERNAL_CONFIG.API_BASE_PATH_V1}/rooms`; const INTERNAL_ROOMS_PATH = `${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/rooms`; @@ -38,7 +44,7 @@ describe('Room API Security Tests', () => { .post(ROOMS_PATH) .set(INTERNAL_CONFIG.API_KEY_HEADER, MEET_API_KEY) .send({}); - expect(response.status).toBe(200); + expect(response.status).toBe(201); }); it('should succeed when users cannot create rooms, and user is authenticated as admin', async () => { @@ -47,7 +53,7 @@ describe('Room API Security Tests', () => { }); const response = await request(app).post(ROOMS_PATH).set('Cookie', adminCookie).send({}); - expect(response.status).toBe(200); + expect(response.status).toBe(201); }); it('should fail when users cannot create rooms, and user is authenticated as user', async () => { @@ -75,7 +81,7 @@ describe('Room API Security Tests', () => { }); const response = await request(app).post(ROOMS_PATH).send({}); - expect(response.status).toBe(200); + expect(response.status).toBe(201); }); it('should succeed when users can create rooms and auth is required, and user is authenticated', async () => { @@ -85,7 +91,7 @@ describe('Room API Security Tests', () => { }); const response = await request(app).post(ROOMS_PATH).set('Cookie', userCookie).send({}); - expect(response.status).toBe(200); + expect(response.status).toBe(201); }); it('should fail when users can create rooms and auth is required, and user is not authenticated', async () => { @@ -299,7 +305,10 @@ describe('Room API Security Tests', () => { describe('Update Room Preferences Tests', () => { const roomPreferences = { - recordingPreferences: { enabled: true }, + recordingPreferences: { + enabled: false, + allowAccessTo: MeetRecordingAccess.ADMIN_MODERATOR_PUBLISHER + }, chatPreferences: { enabled: true }, virtualBackgroundPreferences: { enabled: true } }; diff --git a/backend/tests/utils/assertion-helpers.ts b/backend/tests/utils/assertion-helpers.ts index 2fcf37c..e6e12a3 100644 --- a/backend/tests/utils/assertion-helpers.ts +++ b/backend/tests/utils/assertion-helpers.ts @@ -1,6 +1,7 @@ import { expect } from '@jest/globals'; import INTERNAL_CONFIG from '../../src/config/internal-config'; -import { MeetRecordingStatus, MeetRoom, MeetRoomPreferences } from '../../src/typings/ce'; +import { MeetRecordingAccess, MeetRecordingStatus, MeetRoom, MeetRoomPreferences } from '../../src/typings/ce'; + const RECORDINGS_PATH = `${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/recordings`; const expectErrorResponse = ( @@ -111,7 +112,10 @@ export const expectValidRoom = ( expect(room.preferences).toEqual(preferences); } else { expect(room.preferences).toEqual({ - recordingPreferences: { enabled: true }, + recordingPreferences: { + enabled: true, + allowAccessTo: MeetRecordingAccess.ADMIN_MODERATOR_PUBLISHER + }, chatPreferences: { enabled: true }, virtualBackgroundPreferences: { enabled: true } }); diff --git a/backend/tests/utils/event-controller.ts b/backend/tests/utils/event-controller.ts index ce5fdc5..590ded8 100644 --- a/backend/tests/utils/event-controller.ts +++ b/backend/tests/utils/event-controller.ts @@ -1,4 +1,4 @@ -import { container } from '../../src/config/dependency-injector.config'; +import { container } from '../../src/config/index.js'; import { SystemEventType } from '../../src/models/system-event.model.js'; import { SystemEventService } from '../../src/services/index.js'; diff --git a/backend/tests/utils/helpers.ts b/backend/tests/utils/helpers.ts index 2119f15..fcef7b7 100644 --- a/backend/tests/utils/helpers.ts +++ b/backend/tests/utils/helpers.ts @@ -1,25 +1,24 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ -import request, { Response } from 'supertest'; -import { Express } from 'express'; -import { createApp, registerDependencies } from '../../src/server.js'; -import { - MEET_API_KEY, - MEET_USER, - MEET_SECRET, - MEET_ADMIN_USER, - MEET_ADMIN_SECRET, - LIVEKIT_API_SECRET, - LIVEKIT_API_KEY, - MEET_NAME_ID -} from '../../src/environment.js'; -import { AuthMode, AuthType, MeetRoom, UserRole, MeetRoomOptions } from '../../src/typings/ce/index.js'; import { expect } from '@jest/globals'; -import INTERNAL_CONFIG from '../../src/config/internal-config.js'; import { ChildProcess, execSync, spawn } from 'child_process'; -import { container } from '../../src/config/dependency-injector.config.js'; -import { RoomService } from '../../src/services/room.service.js'; -import { RecordingService } from '../../src/services/recording.service.js'; +import { Express } from 'express'; import ms, { StringValue } from 'ms'; +import request, { Response } from 'supertest'; +import { container } from '../../src/config/index.js'; +import INTERNAL_CONFIG from '../../src/config/internal-config.js'; +import { + LIVEKIT_API_KEY, + LIVEKIT_API_SECRET, + MEET_ADMIN_SECRET, + MEET_ADMIN_USER, + MEET_API_KEY, + MEET_NAME_ID, + MEET_SECRET, + MEET_USER +} from '../../src/environment.js'; +import { createApp, registerDependencies } from '../../src/server.js'; +import { RecordingService, RoomService } from '../../src/services/index.js'; +import { AuthMode, AuthType, MeetRoom, MeetRoomOptions, UserRole } from '../../src/typings/ce/index.js'; const CREDENTIALS = { user: { @@ -52,7 +51,6 @@ export const startTestServer = (): Express => { return app; }; - /** * Updates global security preferences */ @@ -364,7 +362,7 @@ export const getRecording = async (recordingId: string) => { return await request(app) .get(`${INTERNAL_CONFIG.API_BASE_PATH_V1}/recordings/${recordingId}`) .set(INTERNAL_CONFIG.API_KEY_HEADER, MEET_API_KEY); -} +}; export const stopAllRecordings = async (moderatorCookie: string) => { if (!app) { diff --git a/backend/tests/utils/test-scenarios.ts b/backend/tests/utils/test-scenarios.ts index 992ec68..a39d8bd 100644 --- a/backend/tests/utils/test-scenarios.ts +++ b/backend/tests/utils/test-scenarios.ts @@ -1,16 +1,16 @@ import { MeetRoomHelper } from '../../src/helpers'; import { createRoom, - loginUserAsRole, generateParticipantToken, joinFakeParticipant, + loginUserAsRole, + sleep, startRecording, - stopRecording, - sleep + stopRecording } from './helpers'; -import { MeetRoom, UserRole } from '../../src/typings/ce'; import ms, { StringValue } from 'ms'; +import { MeetRoom, UserRole } from '../../src/typings/ce'; import { expectValidStartRecordingResponse } from './assertion-helpers'; export interface RoomData {