tests: Update API path constants to use internal-config module
This commit is contained in:
parent
58dcd83229
commit
ef67924fbc
@ -3,9 +3,9 @@ import { describe, it, expect, beforeAll, afterAll } from '@jest/globals';
|
||||
import { Express } from 'express';
|
||||
import { deleteAllRooms, loginUserAsRole, startTestServer, stopTestServer } from '../../../utils/helpers.js';
|
||||
import { UserRole } from '../../../../src/typings/ce/user.js';
|
||||
import { MEET_API_BASE_PATH_V1 } from '../../../../src/environment.js';
|
||||
import INTERNAL_CONFIG from '../../../../src/config/internal-config.js';
|
||||
|
||||
const ROOMS_PATH = `${MEET_API_BASE_PATH_V1}/rooms`;
|
||||
const ROOMS_PATH = `${INTERNAL_CONFIG.API_BASE_PATH_V1}/rooms`;
|
||||
|
||||
describe('OpenVidu Meet Room API Tests', () => {
|
||||
const validAutoDeletionDate = Date.now() + 2 * 60 * 60 * 1000; // 2 hours ahead
|
||||
|
||||
@ -2,10 +2,10 @@ import request from 'supertest';
|
||||
import { describe, it, expect, beforeAll, afterAll } from '@jest/globals';
|
||||
import { Express } from 'express';
|
||||
import { loginUserAsRole, startTestServer, stopTestServer } from '../../../utils/helpers.js';
|
||||
import { MEET_INTERNAL_API_BASE_PATH_V1 } from '../../../../src/environment.js';
|
||||
import INTERNAL_CONFIG from '../../../../src/config/internal-config.js';
|
||||
import { UserRole } from '../../../../src/typings/ce/index.js';
|
||||
|
||||
const AUTH_PATH = `${MEET_INTERNAL_API_BASE_PATH_V1}/auth`;
|
||||
const AUTH_PATH = `${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/auth`;
|
||||
|
||||
describe('OpenVidu Meet Authentication API Tests', () => {
|
||||
let app: Express;
|
||||
|
||||
@ -3,11 +3,11 @@ import { describe, it, expect, beforeAll, afterAll } from '@jest/globals';
|
||||
import { Express } from 'express';
|
||||
import { createRoom, generateParticipantToken, startTestServer, stopTestServer } from '../../../utils/helpers.js';
|
||||
import { AuthMode, UserRole } from '../../../../src/typings/ce/index.js';
|
||||
import { MEET_INTERNAL_API_BASE_PATH_V1 } from '../../../../src/environment.js';
|
||||
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';
|
||||
|
||||
const PARTICIPANTS_PATH = `${MEET_INTERNAL_API_BASE_PATH_V1}/participants`;
|
||||
const PARTICIPANTS_PATH = `${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/participants`;
|
||||
|
||||
describe('Participant API Security Tests', () => {
|
||||
const PARTICIPANT_NAME = 'testParticipant';
|
||||
|
||||
@ -2,7 +2,6 @@ import request from 'supertest';
|
||||
import { describe, it, expect, beforeAll, afterAll } from '@jest/globals';
|
||||
import { Express } from 'express';
|
||||
import {
|
||||
API_KEY_HEADER,
|
||||
createRoom,
|
||||
deleteAllRooms,
|
||||
generateParticipantToken,
|
||||
@ -10,12 +9,13 @@ import {
|
||||
startTestServer,
|
||||
stopTestServer
|
||||
} from '../../../utils/helpers.js';
|
||||
import { MEET_API_BASE_PATH_V1, MEET_INTERNAL_API_BASE_PATH_V1, MEET_API_KEY } from '../../../../src/environment.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 = `${MEET_API_BASE_PATH_V1}/recordings`;
|
||||
const INTERNAL_RECORDINGS_PATH = `${MEET_INTERNAL_API_BASE_PATH_V1}/recordings`;
|
||||
const RECORDINGS_PATH = `${INTERNAL_CONFIG.API_BASE_PATH_V1}/recordings`;
|
||||
const INTERNAL_RECORDINGS_PATH = `${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/recordings`;
|
||||
|
||||
describe('Room API Security Tests', () => {
|
||||
let app: Express;
|
||||
@ -133,7 +133,7 @@ describe('Room API Security Tests', () => {
|
||||
|
||||
describe('Get Recordings Tests', () => {
|
||||
it('should succeed when request includes API key', async () => {
|
||||
const response = await request(app).get(RECORDINGS_PATH).set(API_KEY_HEADER, MEET_API_KEY);
|
||||
const response = await request(app).get(RECORDINGS_PATH).set(INTERNAL_CONFIG.API_KEY_HEADER, MEET_API_KEY);
|
||||
expect(response.status).toBe(200);
|
||||
});
|
||||
|
||||
@ -157,7 +157,7 @@ describe('Room API Security Tests', () => {
|
||||
it('should succeed when request includes API key', async () => {
|
||||
const response = await request(app)
|
||||
.get(`${RECORDINGS_PATH}/${recordingId}`)
|
||||
.set(API_KEY_HEADER, MEET_API_KEY);
|
||||
.set(INTERNAL_CONFIG.API_KEY_HEADER, MEET_API_KEY);
|
||||
// The response code should be 404 to consider a success because the recording does not exist
|
||||
expect(response.status).toBe(404);
|
||||
});
|
||||
@ -183,7 +183,7 @@ describe('Room API Security Tests', () => {
|
||||
it('should succeed when request includes API key', async () => {
|
||||
const response = await request(app)
|
||||
.delete(`${RECORDINGS_PATH}/${recordingId}`)
|
||||
.set(API_KEY_HEADER, MEET_API_KEY);
|
||||
.set(INTERNAL_CONFIG.API_KEY_HEADER, MEET_API_KEY);
|
||||
// The response code should be 404 to consider a success because the recording does not exist
|
||||
expect(response.status).toBe(404);
|
||||
});
|
||||
@ -210,7 +210,7 @@ describe('Room API Security Tests', () => {
|
||||
const response = await request(app)
|
||||
.delete(RECORDINGS_PATH)
|
||||
.query({ recordingIds: [recordingId] })
|
||||
.set(API_KEY_HEADER, MEET_API_KEY);
|
||||
.set(INTERNAL_CONFIG.API_KEY_HEADER, MEET_API_KEY);
|
||||
expect(response.status).toBe(200);
|
||||
});
|
||||
|
||||
|
||||
@ -3,12 +3,13 @@ import { describe, it, expect, beforeAll, beforeEach, afterAll } from '@jest/glo
|
||||
import { Express } from 'express';
|
||||
import { createRoom, generateParticipantToken, startTestServer, stopTestServer } from '../../../utils/helpers.js';
|
||||
import { AuthMode, UserRole } from '../../../../src/typings/ce/index.js';
|
||||
import { MEET_API_BASE_PATH_V1, MEET_INTERNAL_API_BASE_PATH_V1, MEET_API_KEY } from '../../../../src/environment.js';
|
||||
import { MEET_API_KEY } from '../../../../src/environment.js';
|
||||
import INTERNAL_CONFIG from '../../../../src/config/internal-config.js';
|
||||
import { MeetRoomHelper } from '../../../../src/helpers/room.helper.js';
|
||||
import { API_KEY_HEADER, changeSecurityPreferences, deleteAllRooms, loginUserAsRole } from '../../../utils/helpers.js';
|
||||
import { changeSecurityPreferences, deleteAllRooms, loginUserAsRole } from '../../../utils/helpers.js';
|
||||
|
||||
const ROOMS_PATH = `${MEET_API_BASE_PATH_V1}/rooms`;
|
||||
const INTERNAL_ROOMS_PATH = `${MEET_INTERNAL_API_BASE_PATH_V1}/rooms`;
|
||||
const ROOMS_PATH = `${INTERNAL_CONFIG.API_BASE_PATH_V1}/rooms`;
|
||||
const INTERNAL_ROOMS_PATH = `${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/rooms`;
|
||||
|
||||
describe('Room API Security Tests', () => {
|
||||
let app: Express;
|
||||
@ -34,7 +35,10 @@ describe('Room API Security Tests', () => {
|
||||
usersCanCreateRooms: false
|
||||
});
|
||||
|
||||
const response = await request(app).post(ROOMS_PATH).set(API_KEY_HEADER, MEET_API_KEY).send({});
|
||||
const response = await request(app)
|
||||
.post(ROOMS_PATH)
|
||||
.set(INTERNAL_CONFIG.API_KEY_HEADER, MEET_API_KEY)
|
||||
.send({});
|
||||
expect(response.status).toBe(200);
|
||||
});
|
||||
|
||||
@ -98,7 +102,7 @@ describe('Room API Security Tests', () => {
|
||||
|
||||
describe('Get Rooms Tests', () => {
|
||||
it('should succeed when request includes API key', async () => {
|
||||
const response = await request(app).get(ROOMS_PATH).set(API_KEY_HEADER, MEET_API_KEY);
|
||||
const response = await request(app).get(ROOMS_PATH).set(INTERNAL_CONFIG.API_KEY_HEADER, MEET_API_KEY);
|
||||
expect(response.status).toBe(200);
|
||||
});
|
||||
|
||||
@ -130,7 +134,7 @@ describe('Room API Security Tests', () => {
|
||||
const response = await request(app)
|
||||
.delete(ROOMS_PATH)
|
||||
.query({ roomIds: roomId })
|
||||
.set(API_KEY_HEADER, MEET_API_KEY);
|
||||
.set(INTERNAL_CONFIG.API_KEY_HEADER, MEET_API_KEY);
|
||||
expect(response.status).toBe(204);
|
||||
});
|
||||
|
||||
@ -169,7 +173,9 @@ describe('Room API Security Tests', () => {
|
||||
});
|
||||
|
||||
it('should succeed when request includes API key', async () => {
|
||||
const response = await request(app).get(`${ROOMS_PATH}/${roomId}`).set(API_KEY_HEADER, MEET_API_KEY);
|
||||
const response = await request(app)
|
||||
.get(`${ROOMS_PATH}/${roomId}`)
|
||||
.set(INTERNAL_CONFIG.API_KEY_HEADER, MEET_API_KEY);
|
||||
expect(response.status).toBe(200);
|
||||
});
|
||||
|
||||
@ -270,7 +276,9 @@ describe('Room API Security Tests', () => {
|
||||
});
|
||||
|
||||
it('should succeed when request includes API key', async () => {
|
||||
const response = await request(app).delete(`${ROOMS_PATH}/${roomId}`).set(API_KEY_HEADER, MEET_API_KEY);
|
||||
const response = await request(app)
|
||||
.delete(`${ROOMS_PATH}/${roomId}`)
|
||||
.set(INTERNAL_CONFIG.API_KEY_HEADER, MEET_API_KEY);
|
||||
expect(response.status).toBe(204);
|
||||
});
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user