backend: enhance bulk delete recording tests with cleanup validation

This commit is contained in:
Carlos Santos 2025-06-11 14:28:04 +02:00
parent 2b7fad8842
commit d06747eb5c

View File

@ -1,4 +1,4 @@
import { afterAll, beforeAll, describe, expect, it } from '@jest/globals';
import { afterAll, afterEach, beforeAll, describe, expect, it } from '@jest/globals';
import { container } from '../../../../src/config';
import { MeetStorageService } from '../../../../src/services';
import { expectValidationError, expectValidStartRecordingResponse } from '../../../helpers/assertion-helpers';
@ -6,6 +6,7 @@ import {
bulkDeleteRecordings,
deleteAllRecordings,
deleteAllRooms,
getAllRecordings,
startRecording,
startTestServer,
stopRecording
@ -15,13 +16,19 @@ import { setupMultiRecordingsTestContext } from '../../../helpers/test-scenarios
describe('Recording API Tests', () => {
beforeAll(async () => {
startTestServer();
await Promise.all([deleteAllRooms(), deleteAllRecordings()]);
});
afterAll(async () => {
await Promise.all([deleteAllRooms(), deleteAllRecordings()]);
});
afterEach(async () => {
// Ensure a clean state after each test
await Promise.all([deleteAllRooms(), deleteAllRecordings()]);
const recordings = await getAllRecordings();
expect(recordings.body.recordings).toHaveLength(0);
});
describe('Bulk Delete Recording Tests', () => {
it('should return 200 when mixed valid and non-existent IDs are provided', async () => {
const testContext = await setupMultiRecordingsTestContext(3, 3, 3);