From b059b88be4732b98e2b7edc20197f0764e627f66 Mon Sep 17 00:00:00 2001 From: cruizba Date: Mon, 2 Feb 2026 20:51:03 +0100 Subject: [PATCH] fix tests: Update API path construction with new path --- .../backend/tests/helpers/request-helpers.ts | 96 +++++++++++-------- .../api/api-keys/create-api-key.test.ts | 5 +- .../api/api-keys/delete-api-keys.test.ts | 3 +- .../tests/integration/api/auth/login.test.ts | 4 +- .../tests/integration/api/auth/logout.test.ts | 4 +- .../api/auth/refresh-token.test.ts | 4 +- .../api/recordings/get-recording-url.test.ts | 3 +- .../integration/api/rooms/create-room.test.ts | 4 +- .../api/rooms/e2ee-room-config.test.ts | 3 +- .../api/security/analytics-security.test.ts | 4 +- .../api/security/api-key-security.test.ts | 4 +- .../security/global-config-security.test.ts | 4 +- .../api/security/meeting-security.test.ts | 3 +- .../api/security/recording-security.test.ts | 5 +- .../api/security/room-security.test.ts | 5 +- .../api/security/user-security.test.ts | 4 +- 16 files changed, 89 insertions(+), 66 deletions(-) diff --git a/meet-ce/backend/tests/helpers/request-helpers.ts b/meet-ce/backend/tests/helpers/request-helpers.ts index 16b5b7c9..3f6106b8 100644 --- a/meet-ce/backend/tests/helpers/request-helpers.ts +++ b/meet-ce/backend/tests/helpers/request-helpers.ts @@ -31,6 +31,22 @@ import { ApiKeyService } from '../../src/services/api-key.service.js'; import { GlobalConfigService } from '../../src/services/global-config.service.js'; import { RecordingService } from '../../src/services/recording.service.js'; import { RoomScheduledTasksService } from '../../src/services/room-scheduled-tasks.service.js'; +import { getBasePath } from '../../src/utils/html-injection.utils.js'; + +/** + * Constructs the full API path by prepending the base path. + * Handles trailing/leading slashes to avoid double slashes. + */ +export const getFullPath = (apiPath: string): string => { + const basePath = getBasePath(); + + // Remove trailing slash from base path if apiPath starts with / + if (basePath.endsWith('/') && apiPath.startsWith('/')) { + return basePath.slice(0, -1) + apiPath; + } + + return basePath + apiPath; +}; const CREDENTIALS = { admin: { @@ -62,7 +78,7 @@ export const generateApiKey = async (): Promise => { const accessToken = await loginUser(); const response = await request(app) - .post(`${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/api-keys`) + .post(getFullPath(`${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/api-keys`)) .set(INTERNAL_CONFIG.ACCESS_TOKEN_HEADER, accessToken) .send(); expect(response.status).toBe(201); @@ -75,7 +91,7 @@ export const getApiKeys = async () => { const accessToken = await loginUser(); const response = await request(app) - .get(`${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/api-keys`) + .get(getFullPath(`${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/api-keys`)) .set(INTERNAL_CONFIG.ACCESS_TOKEN_HEADER, accessToken) .send(); return response; @@ -86,7 +102,7 @@ export const deleteApiKeys = async () => { const accessToken = await loginUser(); const response = await request(app) - .delete(`${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/api-keys`) + .delete(getFullPath(`${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/api-keys`)) .set(INTERNAL_CONFIG.ACCESS_TOKEN_HEADER, accessToken) .send(); return response; @@ -109,7 +125,7 @@ export const getRoomsAppearanceConfig = async () => { checkAppIsRunning(); const response = await request(app) - .get(`${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/config/rooms/appearance`) + .get(getFullPath(`${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/config/rooms/appearance`)) .send(); return response; }; @@ -119,7 +135,7 @@ export const updateRoomsAppearanceConfig = async (config: { appearance: MeetAppe const accessToken = await loginUser(); const response = await request(app) - .put(`${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/config/rooms/appearance`) + .put(getFullPath(`${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/config/rooms/appearance`)) .set(INTERNAL_CONFIG.ACCESS_TOKEN_HEADER, accessToken) .send(config); return response; @@ -130,7 +146,7 @@ export const getWebbhookConfig = async () => { const accessToken = await loginUser(); const response = await request(app) - .get(`${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/config/webhooks`) + .get(getFullPath(`${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/config/webhooks`)) .set(INTERNAL_CONFIG.ACCESS_TOKEN_HEADER, accessToken) .send(); return response; @@ -141,7 +157,7 @@ export const updateWebbhookConfig = async (config: WebhookConfig) => { const accessToken = await loginUser(); const response = await request(app) - .put(`${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/config/webhooks`) + .put(getFullPath(`${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/config/webhooks`)) .set(INTERNAL_CONFIG.ACCESS_TOKEN_HEADER, accessToken) .send(config); @@ -152,7 +168,7 @@ export const testWebhookUrl = async (url: string) => { checkAppIsRunning(); const response = await request(app) - .post(`${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/config/webhooks/test`) + .post(getFullPath(`${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/config/webhooks/test`)) .send({ url }); return response; }; @@ -160,7 +176,7 @@ export const testWebhookUrl = async (url: string) => { export const getSecurityConfig = async () => { checkAppIsRunning(); - const response = await request(app).get(`${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/config/security`).send(); + const response = await request(app).get(getFullPath(`${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/config/security`)).send(); return response; }; @@ -169,7 +185,7 @@ export const updateSecurityConfig = async (config: SecurityConfig) => { const accessToken = await loginUser(); const response = await request(app) - .put(`${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/config/security`) + .put(getFullPath(`${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/config/security`)) .set(INTERNAL_CONFIG.ACCESS_TOKEN_HEADER, accessToken) .send(config); return response; @@ -189,7 +205,7 @@ export const changeSecurityConfig = async (authMode: AuthMode) => { export const getCaptionsConfig = async () => { checkAppIsRunning(); - const response = await request(app).get(`${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/config/captions`).send(); + const response = await request(app).get(getFullPath(`${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/config/captions`)).send(); return response; }; @@ -206,7 +222,7 @@ export const loginUser = async (): Promise => { checkAppIsRunning(); const response = await request(app) - .post(`${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/auth/login`) + .post(getFullPath(`${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/auth/login`)) .send(CREDENTIALS.admin) .expect(200); @@ -218,7 +234,7 @@ export const getProfile = async (accessToken: string) => { checkAppIsRunning(); return await request(app) - .get(`${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/users/profile`) + .get(getFullPath(`${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/users/profile`)) .set(INTERNAL_CONFIG.ACCESS_TOKEN_HEADER, accessToken) .send(); }; @@ -227,7 +243,7 @@ export const changePassword = async (currentPassword: string, newPassword: strin checkAppIsRunning(); return await request(app) - .post(`${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/users/change-password`) + .post(getFullPath(`${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/users/change-password`)) .set(INTERNAL_CONFIG.ACCESS_TOKEN_HEADER, accessToken) .send({ currentPassword, newPassword }); }; @@ -236,7 +252,7 @@ export const createRoom = async (options: MeetRoomOptions = {}): Promise = {}) => { checkAppIsRunning(); return await request(app) - .get(`${INTERNAL_CONFIG.API_BASE_PATH_V1}/rooms`) + .get(getFullPath(`${INTERNAL_CONFIG.API_BASE_PATH_V1}/rooms`)) .set(INTERNAL_CONFIG.API_KEY_HEADER, MEET_ENV.INITIAL_API_KEY) .query(query); }; @@ -264,7 +280,7 @@ export const getRooms = async (query: Record = {}) => { export const getRoom = async (roomId: string, fields?: string, roomMemberToken?: string) => { checkAppIsRunning(); - const req = request(app).get(`${INTERNAL_CONFIG.API_BASE_PATH_V1}/rooms/${roomId}`).query({ fields }); + const req = request(app).get(getFullPath(`${INTERNAL_CONFIG.API_BASE_PATH_V1}/rooms/${roomId}`)).query({ fields }); if (roomMemberToken) { req.set(INTERNAL_CONFIG.ROOM_MEMBER_TOKEN_HEADER, roomMemberToken); @@ -279,7 +295,7 @@ export const getRoomConfig = async (roomId: string): Promise => { checkAppIsRunning(); return await request(app) - .get(`${INTERNAL_CONFIG.API_BASE_PATH_V1}/rooms/${roomId}/config`) + .get(getFullPath(`${INTERNAL_CONFIG.API_BASE_PATH_V1}/rooms/${roomId}/config`)) .set(INTERNAL_CONFIG.API_KEY_HEADER, MEET_ENV.INITIAL_API_KEY) .send(); }; @@ -288,7 +304,7 @@ export const updateRoomConfig = async (roomId: string, config: Partial checkAppIsRunning(); const result = await request(app) - .delete(`${INTERNAL_CONFIG.API_BASE_PATH_V1}/rooms/${roomId}`) + .delete(getFullPath(`${INTERNAL_CONFIG.API_BASE_PATH_V1}/rooms/${roomId}`)) .set(INTERNAL_CONFIG.API_KEY_HEADER, MEET_ENV.INITIAL_API_KEY) .query(query); await sleep('1s'); @@ -327,7 +343,7 @@ export const bulkDeleteRooms = async (roomIds: string[], withMeeting?: string, w checkAppIsRunning(); const result = await request(app) - .delete(`${INTERNAL_CONFIG.API_BASE_PATH_V1}/rooms`) + .delete(getFullPath(`${INTERNAL_CONFIG.API_BASE_PATH_V1}/rooms`)) .set(INTERNAL_CONFIG.API_KEY_HEADER, MEET_ENV.INITIAL_API_KEY) .query({ roomIds: roomIds.join(','), withMeeting, withRecordings }); await sleep('1s'); @@ -399,7 +415,7 @@ export const getRoomMemberRoles = async (roomId: string) => { checkAppIsRunning(); const response = await request(app) - .get(`${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/rooms/${roomId}/roles`) + .get(getFullPath(`${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/rooms/${roomId}/roles`)) .send(); return response; }; @@ -408,7 +424,7 @@ export const getRoomMemberRoleBySecret = async (roomId: string, secret: string) checkAppIsRunning(); const response = await request(app) - .get(`${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/rooms/${roomId}/roles/${secret}`) + .get(getFullPath(`${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/rooms/${roomId}/roles/${secret}`)) .send(); return response; }; @@ -421,7 +437,7 @@ export const generateRoomMemberTokenRequest = async (roomId: string, tokenOption // Generate the room member token const response = await request(app) - .post(`${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/rooms/${roomId}/token`) + .post(getFullPath(`${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/rooms/${roomId}/token`)) .send(tokenOptions); return response; }; @@ -563,7 +579,7 @@ export const updateParticipant = async ( checkAppIsRunning(); const response = await request(app) - .put(`${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/meetings/${roomId}/participants/${participantIdentity}/role`) + .put(getFullPath(`${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/meetings/${roomId}/participants/${participantIdentity}/role`)) .set(INTERNAL_CONFIG.ROOM_MEMBER_TOKEN_HEADER, moderatorToken) .send({ role: newRole }); return response; @@ -573,7 +589,7 @@ export const kickParticipant = async (roomId: string, participantIdentity: strin checkAppIsRunning(); const response = await request(app) - .delete(`${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/meetings/${roomId}/participants/${participantIdentity}`) + .delete(getFullPath(`${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/meetings/${roomId}/participants/${participantIdentity}`)) .set(INTERNAL_CONFIG.ROOM_MEMBER_TOKEN_HEADER, moderatorToken) .send(); return response; @@ -583,7 +599,7 @@ export const endMeeting = async (roomId: string, moderatorToken: string) => { checkAppIsRunning(); const response = await request(app) - .delete(`${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/meetings/${roomId}`) + .delete(getFullPath(`${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/meetings/${roomId}`)) .set(INTERNAL_CONFIG.ROOM_MEMBER_TOKEN_HEADER, moderatorToken) .send(); await sleep('1s'); @@ -612,7 +628,7 @@ export const startRecording = async ( } return await request(app) - .post(`${INTERNAL_CONFIG.API_BASE_PATH_V1}/recordings`) + .post(getFullPath(`${INTERNAL_CONFIG.API_BASE_PATH_V1}/recordings`)) .set(INTERNAL_CONFIG.API_KEY_HEADER, MEET_ENV.INITIAL_API_KEY) .send(body); }; @@ -621,7 +637,7 @@ export const stopRecording = async (recordingId: string) => { checkAppIsRunning(); const response = await request(app) - .post(`${INTERNAL_CONFIG.API_BASE_PATH_V1}/recordings/${recordingId}/stop`) + .post(getFullPath(`${INTERNAL_CONFIG.API_BASE_PATH_V1}/recordings/${recordingId}/stop`)) .set(INTERNAL_CONFIG.API_KEY_HEADER, MEET_ENV.INITIAL_API_KEY) .send(); await sleep('2.5s'); @@ -633,7 +649,7 @@ export const getRecording = async (recordingId: string) => { checkAppIsRunning(); return await request(app) - .get(`${INTERNAL_CONFIG.API_BASE_PATH_V1}/recordings/${recordingId}`) + .get(getFullPath(`${INTERNAL_CONFIG.API_BASE_PATH_V1}/recordings/${recordingId}`)) .set(INTERNAL_CONFIG.API_KEY_HEADER, MEET_ENV.INITIAL_API_KEY); }; @@ -641,7 +657,7 @@ export const getRecordingMedia = async (recordingId: string, range?: string) => checkAppIsRunning(); const req = request(app) - .get(`${INTERNAL_CONFIG.API_BASE_PATH_V1}/recordings/${recordingId}/media`) + .get(getFullPath(`${INTERNAL_CONFIG.API_BASE_PATH_V1}/recordings/${recordingId}/media`)) .set(INTERNAL_CONFIG.API_KEY_HEADER, MEET_ENV.INITIAL_API_KEY); if (range) { @@ -655,7 +671,7 @@ export const getRecordingUrl = async (recordingId: string, privateAccess = false checkAppIsRunning(); return await request(app) - .get(`${INTERNAL_CONFIG.API_BASE_PATH_V1}/recordings/${recordingId}/url`) + .get(getFullPath(`${INTERNAL_CONFIG.API_BASE_PATH_V1}/recordings/${recordingId}/url`)) .query({ privateAccess }) .set(INTERNAL_CONFIG.API_KEY_HEADER, MEET_ENV.INITIAL_API_KEY); }; @@ -664,7 +680,7 @@ export const deleteRecording = async (recordingId: string) => { checkAppIsRunning(); return await request(app) - .delete(`${INTERNAL_CONFIG.API_BASE_PATH_V1}/recordings/${recordingId}`) + .delete(getFullPath(`${INTERNAL_CONFIG.API_BASE_PATH_V1}/recordings/${recordingId}`)) .set(INTERNAL_CONFIG.API_KEY_HEADER, MEET_ENV.INITIAL_API_KEY); }; @@ -672,7 +688,7 @@ export const bulkDeleteRecordings = async (recordingIds: string[], roomMemberTok checkAppIsRunning(); const req = request(app) - .delete(`${INTERNAL_CONFIG.API_BASE_PATH_V1}/recordings`) + .delete(getFullPath(`${INTERNAL_CONFIG.API_BASE_PATH_V1}/recordings`)) .query({ recordingIds: recordingIds.join(',') }); if (roomMemberToken) { @@ -692,7 +708,7 @@ export const downloadRecordings = async ( checkAppIsRunning(); const req = request(app) - .get(`${INTERNAL_CONFIG.API_BASE_PATH_V1}/recordings/download`) + .get(getFullPath(`${INTERNAL_CONFIG.API_BASE_PATH_V1}/recordings/download`)) .query({ recordingIds: recordingIds.join(',') }); if (roomMemberToken) { @@ -728,7 +744,7 @@ export const stopAllRecordings = async () => { console.log(`Stopping ${recordingIds.length} recordings...`, recordingIds); const tasks = recordingIds.map((recordingId: string) => request(app) - .post(`${INTERNAL_CONFIG.API_BASE_PATH_V1}/recordings/${recordingId}/stop`) + .post(getFullPath(`${INTERNAL_CONFIG.API_BASE_PATH_V1}/recordings/${recordingId}/stop`)) .set(INTERNAL_CONFIG.API_KEY_HEADER, MEET_ENV.INITIAL_API_KEY) .send() ); @@ -745,7 +761,7 @@ export const getAllRecordings = async (query: Record = {}) => { checkAppIsRunning(); return await request(app) - .get(`${INTERNAL_CONFIG.API_BASE_PATH_V1}/recordings`) + .get(getFullPath(`${INTERNAL_CONFIG.API_BASE_PATH_V1}/recordings`)) .set(INTERNAL_CONFIG.API_KEY_HEADER, MEET_ENV.INITIAL_API_KEY) .query(query); }; @@ -754,7 +770,7 @@ export const getAllRecordingsFromRoom = async (roomMemberToken: string) => { checkAppIsRunning(); return await request(app) - .get(`${INTERNAL_CONFIG.API_BASE_PATH_V1}/recordings`) + .get(getFullPath(`${INTERNAL_CONFIG.API_BASE_PATH_V1}/recordings`)) .set(INTERNAL_CONFIG.ROOM_MEMBER_TOKEN_HEADER, roomMemberToken); }; @@ -789,7 +805,7 @@ export const getAnalytics = async () => { const accessToken = await loginUser(); const response = await request(app) - .get(`${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/analytics`) + .get(getFullPath(`${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/analytics`)) .set(INTERNAL_CONFIG.ACCESS_TOKEN_HEADER, accessToken) .send(); diff --git a/meet-ce/backend/tests/integration/api/api-keys/create-api-key.test.ts b/meet-ce/backend/tests/integration/api/api-keys/create-api-key.test.ts index 6628a88e..c9a4bda0 100644 --- a/meet-ce/backend/tests/integration/api/api-keys/create-api-key.test.ts +++ b/meet-ce/backend/tests/integration/api/api-keys/create-api-key.test.ts @@ -5,12 +5,13 @@ import { INTERNAL_CONFIG } from '../../../../src/config/internal-config.js'; import { generateApiKey, getApiKeys, + getFullPath, loginUser, restoreDefaultApiKeys, startTestServer } from '../../../helpers/request-helpers.js'; -const API_KEYS_PATH = `${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/api-keys`; +const API_KEYS_PATH = getFullPath(`${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/api-keys`); describe('API Keys API Tests', () => { let app: Express; @@ -27,7 +28,7 @@ describe('API Keys API Tests', () => { const getRoomsWithApiKey = async (apiKey: string) => { return request(app) - .get(`${INTERNAL_CONFIG.API_BASE_PATH_V1}/rooms`) + .get(getFullPath(`${INTERNAL_CONFIG.API_BASE_PATH_V1}/rooms`)) .set(INTERNAL_CONFIG.API_KEY_HEADER, apiKey); }; diff --git a/meet-ce/backend/tests/integration/api/api-keys/delete-api-keys.test.ts b/meet-ce/backend/tests/integration/api/api-keys/delete-api-keys.test.ts index 69d0dae4..ca09b2fa 100644 --- a/meet-ce/backend/tests/integration/api/api-keys/delete-api-keys.test.ts +++ b/meet-ce/backend/tests/integration/api/api-keys/delete-api-keys.test.ts @@ -6,6 +6,7 @@ import { deleteApiKeys, generateApiKey, getApiKeys, + getFullPath, restoreDefaultApiKeys, startTestServer } from '../../../helpers/request-helpers.js'; @@ -23,7 +24,7 @@ describe('API Keys API Tests', () => { const getRoomsWithApiKey = async (apiKey: string) => { return request(app) - .get(`${INTERNAL_CONFIG.API_BASE_PATH_V1}/rooms`) + .get(getFullPath(`${INTERNAL_CONFIG.API_BASE_PATH_V1}/rooms`)) .set(INTERNAL_CONFIG.API_KEY_HEADER, apiKey); }; diff --git a/meet-ce/backend/tests/integration/api/auth/login.test.ts b/meet-ce/backend/tests/integration/api/auth/login.test.ts index 6485a8cb..3b33518a 100644 --- a/meet-ce/backend/tests/integration/api/auth/login.test.ts +++ b/meet-ce/backend/tests/integration/api/auth/login.test.ts @@ -3,9 +3,9 @@ import { Express } from 'express'; import request from 'supertest'; import { INTERNAL_CONFIG } from '../../../../src/config/internal-config.js'; import { expectValidationError } from '../../../helpers/assertion-helpers.js'; -import { startTestServer } from '../../../helpers/request-helpers.js'; +import { getFullPath, startTestServer } from '../../../helpers/request-helpers.js'; -const AUTH_PATH = `${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/auth`; +const AUTH_PATH = getFullPath(`${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/auth`); describe('Authentication API Tests', () => { let app: Express; diff --git a/meet-ce/backend/tests/integration/api/auth/logout.test.ts b/meet-ce/backend/tests/integration/api/auth/logout.test.ts index bdfca976..56e85b58 100644 --- a/meet-ce/backend/tests/integration/api/auth/logout.test.ts +++ b/meet-ce/backend/tests/integration/api/auth/logout.test.ts @@ -2,9 +2,9 @@ import { 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 { startTestServer } from '../../../helpers/request-helpers.js'; +import { getFullPath, startTestServer } from '../../../helpers/request-helpers.js'; -const AUTH_PATH = `${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/auth`; +const AUTH_PATH = getFullPath(`${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/auth`); describe('Authentication API Tests', () => { let app: Express; diff --git a/meet-ce/backend/tests/integration/api/auth/refresh-token.test.ts b/meet-ce/backend/tests/integration/api/auth/refresh-token.test.ts index a1d76b3c..8e1341c4 100644 --- a/meet-ce/backend/tests/integration/api/auth/refresh-token.test.ts +++ b/meet-ce/backend/tests/integration/api/auth/refresh-token.test.ts @@ -2,9 +2,9 @@ import { 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 { startTestServer } from '../../../helpers/request-helpers.js'; +import { getFullPath, startTestServer } from '../../../helpers/request-helpers.js'; -const AUTH_PATH = `${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/auth`; +const AUTH_PATH = getFullPath(`${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/auth`); describe('Authentication API Tests', () => { let app: Express; diff --git a/meet-ce/backend/tests/integration/api/recordings/get-recording-url.test.ts b/meet-ce/backend/tests/integration/api/recordings/get-recording-url.test.ts index b643c9d3..5db4c387 100644 --- a/meet-ce/backend/tests/integration/api/recordings/get-recording-url.test.ts +++ b/meet-ce/backend/tests/integration/api/recordings/get-recording-url.test.ts @@ -6,6 +6,7 @@ import { deleteAllRecordings, deleteAllRooms, disconnectFakeParticipants, + getFullPath, getRecordingUrl, startTestServer } from '../../../helpers/request-helpers.js'; @@ -31,7 +32,7 @@ describe('Recording API Tests', () => { }); describe('Get Recording URL Tests', () => { - const RECORDINGS_PATH = `${INTERNAL_CONFIG.API_BASE_PATH_V1}/recordings`; + const RECORDINGS_PATH = getFullPath(`${INTERNAL_CONFIG.API_BASE_PATH_V1}/recordings`); it('should get public recording URL', async () => { const response = await getRecordingUrl(recordingId); diff --git a/meet-ce/backend/tests/integration/api/rooms/create-room.test.ts b/meet-ce/backend/tests/integration/api/rooms/create-room.test.ts index da203198..60377f95 100644 --- a/meet-ce/backend/tests/integration/api/rooms/create-room.test.ts +++ b/meet-ce/backend/tests/integration/api/rooms/create-room.test.ts @@ -20,9 +20,9 @@ import { expectValidRoom, expectValidationError } from '../../../helpers/assertion-helpers.js'; -import { createRoom, deleteAllRooms, startTestServer } from '../../../helpers/request-helpers.js'; +import { createRoom, deleteAllRooms, getFullPath, startTestServer } from '../../../helpers/request-helpers.js'; -const ROOMS_PATH = `${INTERNAL_CONFIG.API_BASE_PATH_V1}/rooms`; +const ROOMS_PATH = getFullPath(`${INTERNAL_CONFIG.API_BASE_PATH_V1}/rooms`); describe('Room API Tests', () => { const validAutoDeletionDate = Date.now() + ms('2h'); diff --git a/meet-ce/backend/tests/integration/api/rooms/e2ee-room-config.test.ts b/meet-ce/backend/tests/integration/api/rooms/e2ee-room-config.test.ts index 2c497374..3eb76418 100644 --- a/meet-ce/backend/tests/integration/api/rooms/e2ee-room-config.test.ts +++ b/meet-ce/backend/tests/integration/api/rooms/e2ee-room-config.test.ts @@ -9,6 +9,7 @@ import { createRoom, deleteAllRecordings, deleteAllRooms, + getFullPath, getRoomConfig, startRecording, startTestServer, @@ -16,7 +17,7 @@ import { } from '../../../helpers/request-helpers.js'; import { setupMultiRoomTestContext } from '../../../helpers/test-scenarios.js'; -const ROOMS_PATH = `${INTERNAL_CONFIG.API_BASE_PATH_V1}/rooms`; +const ROOMS_PATH = getFullPath(`${INTERNAL_CONFIG.API_BASE_PATH_V1}/rooms`); describe('E2EE Room Configuration Tests', () => { let app: Express; diff --git a/meet-ce/backend/tests/integration/api/security/analytics-security.test.ts b/meet-ce/backend/tests/integration/api/security/analytics-security.test.ts index 814f163d..19832803 100644 --- a/meet-ce/backend/tests/integration/api/security/analytics-security.test.ts +++ b/meet-ce/backend/tests/integration/api/security/analytics-security.test.ts @@ -3,9 +3,9 @@ import { Express } from 'express'; import request from 'supertest'; import { INTERNAL_CONFIG } from '../../../../src/config/internal-config.js'; import { MEET_ENV } from '../../../../src/environment.js'; -import { loginUser, startTestServer } from '../../../helpers/request-helpers.js'; +import { getFullPath, loginUser, startTestServer } from '../../../helpers/request-helpers.js'; -const ANALYTICS_PATH = `${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/analytics`; +const ANALYTICS_PATH = getFullPath(`${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/analytics`); describe('Analytics API Security Tests', () => { let app: Express; diff --git a/meet-ce/backend/tests/integration/api/security/api-key-security.test.ts b/meet-ce/backend/tests/integration/api/security/api-key-security.test.ts index 69481cfb..bb224b13 100644 --- a/meet-ce/backend/tests/integration/api/security/api-key-security.test.ts +++ b/meet-ce/backend/tests/integration/api/security/api-key-security.test.ts @@ -2,9 +2,9 @@ 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 { generateApiKey, loginUser, restoreDefaultApiKeys, startTestServer } from '../../../helpers/request-helpers.js'; +import { generateApiKey, getFullPath, loginUser, restoreDefaultApiKeys, startTestServer } from '../../../helpers/request-helpers.js'; -const API_KEYS_PATH = `${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/api-keys`; +const API_KEYS_PATH = getFullPath(`${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/api-keys`); describe('API Keys API Security Tests', () => { let app: Express; diff --git a/meet-ce/backend/tests/integration/api/security/global-config-security.test.ts b/meet-ce/backend/tests/integration/api/security/global-config-security.test.ts index 531bf866..ebf5fa49 100644 --- a/meet-ce/backend/tests/integration/api/security/global-config-security.test.ts +++ b/meet-ce/backend/tests/integration/api/security/global-config-security.test.ts @@ -4,9 +4,9 @@ import { Express } from 'express'; import request from 'supertest'; import { INTERNAL_CONFIG } from '../../../../src/config/internal-config.js'; import { MEET_ENV } from '../../../../src/environment.js'; -import { loginUser, restoreDefaultGlobalConfig, startTestServer } from '../../../helpers/request-helpers.js'; +import { getFullPath, loginUser, restoreDefaultGlobalConfig, startTestServer } from '../../../helpers/request-helpers.js'; -const CONFIG_PATH = `${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/config`; +const CONFIG_PATH = getFullPath(`${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/config`); describe('Global Config API Security Tests', () => { let app: Express; diff --git a/meet-ce/backend/tests/integration/api/security/meeting-security.test.ts b/meet-ce/backend/tests/integration/api/security/meeting-security.test.ts index 14cc70f7..c7957fec 100644 --- a/meet-ce/backend/tests/integration/api/security/meeting-security.test.ts +++ b/meet-ce/backend/tests/integration/api/security/meeting-security.test.ts @@ -8,6 +8,7 @@ import { getPermissions } from '../../../helpers/assertion-helpers.js'; import { deleteAllRooms, disconnectFakeParticipants, + getFullPath, loginUser, startTestServer, updateParticipantMetadata @@ -15,7 +16,7 @@ import { import { setupSingleRoom } from '../../../helpers/test-scenarios.js'; import { RoomData } from '../../../interfaces/scenarios.js'; -const MEETINGS_PATH = `${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/meetings`; +const MEETINGS_PATH = getFullPath(`${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/meetings`); describe('Meeting API Security Tests', () => { let app: Express; diff --git a/meet-ce/backend/tests/integration/api/security/recording-security.test.ts b/meet-ce/backend/tests/integration/api/security/recording-security.test.ts index aab1c2da..b43edf3a 100644 --- a/meet-ce/backend/tests/integration/api/security/recording-security.test.ts +++ b/meet-ce/backend/tests/integration/api/security/recording-security.test.ts @@ -10,6 +10,7 @@ import { disconnectFakeParticipants, endMeeting, generateRoomMemberToken, + getFullPath, getRecordingUrl, loginUser, startTestServer, @@ -19,8 +20,8 @@ import { import { setupSingleRoom, setupSingleRoomWithRecording } from '../../../helpers/test-scenarios.js'; import { RoomData } from '../../../interfaces/scenarios.js'; -const RECORDINGS_PATH = `${INTERNAL_CONFIG.API_BASE_PATH_V1}/recordings`; -// const INTERNAL_RECORDINGS_PATH = `${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/recordings`; +const RECORDINGS_PATH = getFullPath(`${INTERNAL_CONFIG.API_BASE_PATH_V1}/recordings`); +// const INTERNAL_RECORDINGS_PATH = getFullPath(`${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/recordings`); describe('Recording API Security Tests', () => { let app: Express; diff --git a/meet-ce/backend/tests/integration/api/security/room-security.test.ts b/meet-ce/backend/tests/integration/api/security/room-security.test.ts index e42e2b30..747c4148 100644 --- a/meet-ce/backend/tests/integration/api/security/room-security.test.ts +++ b/meet-ce/backend/tests/integration/api/security/room-security.test.ts @@ -8,6 +8,7 @@ import { changeSecurityConfig, createRoom, deleteAllRooms, + getFullPath, loginUser, sleep, startTestServer @@ -15,8 +16,8 @@ import { import { setupSingleRoom } from '../../../helpers/test-scenarios.js'; import { RoomData } from '../../../interfaces/scenarios.js'; -const ROOMS_PATH = `${INTERNAL_CONFIG.API_BASE_PATH_V1}/rooms`; -const INTERNAL_ROOMS_PATH = `${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/rooms`; +const ROOMS_PATH = getFullPath(`${INTERNAL_CONFIG.API_BASE_PATH_V1}/rooms`); +const INTERNAL_ROOMS_PATH = getFullPath(`${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/rooms`); describe('Room API Security Tests', () => { let app: Express; diff --git a/meet-ce/backend/tests/integration/api/security/user-security.test.ts b/meet-ce/backend/tests/integration/api/security/user-security.test.ts index 436a0bdf..f389fe64 100644 --- a/meet-ce/backend/tests/integration/api/security/user-security.test.ts +++ b/meet-ce/backend/tests/integration/api/security/user-security.test.ts @@ -3,9 +3,9 @@ import { Express } from 'express'; import request from 'supertest'; import { INTERNAL_CONFIG } from '../../../../src/config/internal-config.js'; import { MEET_ENV } from '../../../../src/environment.js'; -import { changePassword, loginUser, startTestServer } from '../../../helpers/request-helpers.js'; +import { changePassword, getFullPath, loginUser, startTestServer } from '../../../helpers/request-helpers.js'; -const USERS_PATH = `${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/users`; +const USERS_PATH = getFullPath(`${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/users`); describe('User API Security Tests', () => { let app: Express;