backend: refactor test cleanup to sequentially delete rooms and recordings
This commit is contained in:
parent
248015fc06
commit
5cbd05be11
@ -18,7 +18,8 @@ describe('Analytics API Tests', () => {
|
||||
|
||||
afterEach(async () => {
|
||||
await disconnectFakeParticipants();
|
||||
await Promise.all([deleteAllRooms(), deleteAllRecordings()]);
|
||||
await deleteAllRooms();
|
||||
await deleteAllRecordings();
|
||||
});
|
||||
|
||||
describe('Get analytics', () => {
|
||||
|
||||
@ -21,7 +21,8 @@ describe('Recording API Tests', () => {
|
||||
afterEach(async () => {
|
||||
// Ensure a clean state after each test
|
||||
await disconnectFakeParticipants();
|
||||
await Promise.all([deleteAllRooms(), deleteAllRecordings()]);
|
||||
await deleteAllRooms();
|
||||
await deleteAllRecordings();
|
||||
const recordings = await getAllRecordings();
|
||||
expect(recordings.body.recordings).toHaveLength(0);
|
||||
});
|
||||
|
||||
@ -20,7 +20,8 @@ describe('Recording API Tests', () => {
|
||||
|
||||
afterAll(async () => {
|
||||
await disconnectFakeParticipants();
|
||||
await Promise.all([deleteAllRooms(), deleteAllRecordings()]);
|
||||
await deleteAllRooms();
|
||||
await deleteAllRecordings();
|
||||
});
|
||||
|
||||
describe('Delete Recording Tests', () => {
|
||||
@ -35,7 +36,8 @@ describe('Recording API Tests', () => {
|
||||
|
||||
afterAll(async () => {
|
||||
await stopAllRecordings();
|
||||
await Promise.all([deleteAllRecordings(), deleteAllRooms()]);
|
||||
await deleteAllRooms();
|
||||
await deleteAllRecordings();
|
||||
});
|
||||
|
||||
it('should delete a recording successfully', async () => {
|
||||
@ -61,7 +63,8 @@ describe('Recording API Tests', () => {
|
||||
|
||||
afterAll(async () => {
|
||||
await stopAllRecordings();
|
||||
await Promise.all([deleteAllRecordings(), deleteAllRooms()]);
|
||||
await deleteAllRooms();
|
||||
await deleteAllRecordings();
|
||||
});
|
||||
|
||||
it('should fail when recordingId has incorrect format', async () => {
|
||||
|
||||
@ -20,7 +20,8 @@ describe('Recording API Tests', () => {
|
||||
|
||||
afterAll(async () => {
|
||||
await disconnectFakeParticipants();
|
||||
await Promise.all([deleteAllRecordings(), deleteAllRooms()]);
|
||||
await deleteAllRooms();
|
||||
await deleteAllRecordings();
|
||||
});
|
||||
|
||||
const getZipEntries = async (buffer: Buffer) => {
|
||||
|
||||
@ -26,7 +26,8 @@ describe('Recording API Tests', () => {
|
||||
|
||||
afterAll(async () => {
|
||||
await disconnectFakeParticipants();
|
||||
await Promise.all([deleteAllRecordings(), deleteAllRooms()]);
|
||||
await deleteAllRooms();
|
||||
await deleteAllRecordings();
|
||||
});
|
||||
|
||||
describe('Recording Media Tests', () => {
|
||||
|
||||
@ -1,7 +1,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 { errorRecordingNotFound } from '../../../../src/models/error.model.js';
|
||||
import { expectValidGetRecordingUrlResponse } from '../../../helpers/assertion-helpers.js';
|
||||
import {
|
||||
deleteAllRecordings,
|
||||
deleteAllRooms,
|
||||
@ -11,8 +13,6 @@ import {
|
||||
startTestServer
|
||||
} from '../../../helpers/request-helpers.js';
|
||||
import { setupSingleRoomWithRecording } from '../../../helpers/test-scenarios.js';
|
||||
import { expectValidGetRecordingUrlResponse } from '../../../helpers/assertion-helpers.js';
|
||||
import { INTERNAL_CONFIG } from '../../../../src/config/internal-config.js';
|
||||
|
||||
describe('Recording API Tests', () => {
|
||||
let app: Express;
|
||||
@ -28,7 +28,8 @@ describe('Recording API Tests', () => {
|
||||
|
||||
afterAll(async () => {
|
||||
await disconnectFakeParticipants();
|
||||
await Promise.all([deleteAllRooms(), deleteAllRecordings()]);
|
||||
await deleteAllRooms();
|
||||
await deleteAllRecordings();
|
||||
});
|
||||
|
||||
describe('Get Recording URL Tests', () => {
|
||||
|
||||
@ -30,7 +30,8 @@ describe('Recordings API Tests', () => {
|
||||
|
||||
describe('List Recordings Tests', () => {
|
||||
beforeEach(async () => {
|
||||
await Promise.all([deleteAllRooms(), deleteAllRecordings()]);
|
||||
await deleteAllRooms();
|
||||
await deleteAllRecordings();
|
||||
const response = await getAllRecordings();
|
||||
expect(response.status).toBe(200);
|
||||
expectSuccessListRecordingResponse(response, 0, false, false);
|
||||
@ -38,7 +39,8 @@ describe('Recordings API Tests', () => {
|
||||
|
||||
afterAll(async () => {
|
||||
await disconnectFakeParticipants();
|
||||
await Promise.all([deleteAllRooms(), deleteAllRecordings()]);
|
||||
await deleteAllRooms();
|
||||
await deleteAllRecordings();
|
||||
context = null;
|
||||
});
|
||||
|
||||
@ -184,7 +186,8 @@ describe('Recordings API Tests', () => {
|
||||
|
||||
// Disconnect participants and clean up
|
||||
await disconnectFakeParticipants();
|
||||
await Promise.all([deleteAllRooms(), deleteAllRecordings()]);
|
||||
await deleteAllRooms();
|
||||
await deleteAllRecordings();
|
||||
});
|
||||
|
||||
it('should sort recordings by startDate ascending and descending', async () => {
|
||||
@ -289,10 +292,18 @@ describe('Recordings API Tests', () => {
|
||||
|
||||
describe('List recordings - Fields filtering', () => {
|
||||
beforeAll(async () => {
|
||||
await Promise.all([deleteAllRooms(), deleteAllRecordings()]);
|
||||
await deleteAllRooms();
|
||||
await deleteAllRecordings();
|
||||
context = await setupMultiRecordingsTestContext(2, 2, 2);
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await disconnectFakeParticipants();
|
||||
await deleteAllRooms();
|
||||
await deleteAllRecordings();
|
||||
context = null;
|
||||
});
|
||||
|
||||
it('should filter fields using X-Fields header', async () => {
|
||||
const response = await getAllRecordings({}, { xFields: 'recordingId,roomId' });
|
||||
expectSuccessListRecordingResponse(response, 2, false, false);
|
||||
|
||||
@ -43,7 +43,8 @@ describe('Recording API Race Conditions Tests', () => {
|
||||
|
||||
eventController.reset();
|
||||
await disconnectFakeParticipants();
|
||||
await Promise.all([deleteAllRecordings(), deleteAllRooms()]);
|
||||
await deleteAllRooms();
|
||||
await deleteAllRecordings();
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
|
||||
|
||||
@ -11,7 +11,6 @@ import {
|
||||
stopRecording
|
||||
} from '../../../helpers/request-helpers.js';
|
||||
import { setupSingleRoomWithRecording } from '../../../helpers/test-scenarios.js';
|
||||
import { TestContext } from '../../../interfaces/scenarios.js';
|
||||
|
||||
/**
|
||||
* Tests for X-Fields header and fields query parameter support across all recording operations.
|
||||
@ -22,28 +21,21 @@ import { TestContext } from '../../../interfaces/scenarios.js';
|
||||
* When both are provided, values are merged (union of unique fields).
|
||||
*/
|
||||
describe('Recording Header Fields Tests', () => {
|
||||
let context: TestContext | null = null;
|
||||
|
||||
beforeAll(async () => {
|
||||
await startTestServer();
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await disconnectFakeParticipants();
|
||||
await Promise.all([deleteAllRooms(), deleteAllRecordings()]);
|
||||
context = null;
|
||||
await deleteAllRooms();
|
||||
await deleteAllRecordings();
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
describe('POST /recordings/:recordingId/stop - X-Fields header and fields query param', () => {
|
||||
afterAll(async () => {
|
||||
await disconnectFakeParticipants();
|
||||
await Promise.all([deleteAllRooms(), deleteAllRecordings()]);
|
||||
await deleteAllRooms();
|
||||
await deleteAllRecordings();
|
||||
});
|
||||
|
||||
it('should filter response fields using X-Fields header on stop recording', async () => {
|
||||
|
||||
@ -42,7 +42,8 @@ describe('Recording API Tests', () => {
|
||||
|
||||
afterAll(async () => {
|
||||
await disconnectFakeParticipants();
|
||||
await Promise.all([deleteAllRooms(), deleteAllRecordings()]);
|
||||
await deleteAllRooms();
|
||||
await deleteAllRecordings();
|
||||
});
|
||||
|
||||
describe('Start Recording Tests', () => {
|
||||
@ -54,7 +55,8 @@ describe('Recording API Tests', () => {
|
||||
|
||||
afterAll(async () => {
|
||||
await disconnectFakeParticipants();
|
||||
await Promise.all([deleteAllRooms(), deleteAllRecordings()]);
|
||||
await deleteAllRooms();
|
||||
await deleteAllRecordings();
|
||||
context = null;
|
||||
});
|
||||
|
||||
@ -145,7 +147,8 @@ describe('Recording API Tests', () => {
|
||||
|
||||
afterAll(async () => {
|
||||
await disconnectFakeParticipants();
|
||||
await Promise.all([deleteAllRooms(), deleteAllRecordings()]);
|
||||
await deleteAllRooms();
|
||||
await deleteAllRecordings();
|
||||
context = null;
|
||||
});
|
||||
|
||||
@ -544,7 +547,8 @@ describe('Recording API Tests', () => {
|
||||
|
||||
afterAll(async () => {
|
||||
await disconnectFakeParticipants();
|
||||
await Promise.all([deleteAllRooms(), deleteAllRecordings()]);
|
||||
await deleteAllRooms();
|
||||
await deleteAllRecordings();
|
||||
context = null;
|
||||
});
|
||||
|
||||
|
||||
@ -30,7 +30,8 @@ describe('Recording API Tests', () => {
|
||||
afterAll(async () => {
|
||||
await stopAllRecordings();
|
||||
await disconnectFakeParticipants();
|
||||
await Promise.all([deleteAllRooms(), deleteAllRecordings()]);
|
||||
await deleteAllRooms();
|
||||
await deleteAllRecordings();
|
||||
});
|
||||
|
||||
describe('Stop Recording Tests', () => {
|
||||
|
||||
@ -26,8 +26,8 @@ describe('E2EE Room Configuration Tests', () => {
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await deleteAllRecordings();
|
||||
await deleteAllRooms();
|
||||
await deleteAllRecordings();
|
||||
});
|
||||
|
||||
describe('E2EE Default Configuration', () => {
|
||||
|
||||
@ -41,7 +41,8 @@ describe('Recording API Security Tests', () => {
|
||||
|
||||
afterAll(async () => {
|
||||
await disconnectFakeParticipants();
|
||||
await Promise.all([deleteAllRooms(), deleteAllRecordings()]);
|
||||
await deleteAllRooms();
|
||||
await deleteAllRecordings();
|
||||
await deleteAllUsers();
|
||||
});
|
||||
|
||||
|
||||
@ -70,7 +70,8 @@ describe('Webhook Integration Tests', () => {
|
||||
await restoreDefaultGlobalConfig();
|
||||
|
||||
await disconnectFakeParticipants();
|
||||
await Promise.all([deleteAllRooms(), deleteAllRecordings()]);
|
||||
await deleteAllRooms();
|
||||
await deleteAllRecordings();
|
||||
});
|
||||
|
||||
const expectValidSignature = (webhook: { headers: http.IncomingHttpHeaders; body: MeetWebhookEvent }) => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user