test: add cleanup step to restore API key after authentication tests

This commit is contained in:
juancarmore 2025-08-27 17:49:00 +02:00
parent b249fdde27
commit 294d51f9ad

View File

@ -1,7 +1,9 @@
import { beforeAll, describe, expect, it } from '@jest/globals';
import { afterAll, beforeAll, describe, expect, it } from '@jest/globals';
import { Express } from 'express';
import request from 'supertest';
import { container } from '../../../../src/config/dependency-injector.config.js';
import INTERNAL_CONFIG from '../../../../src/config/internal-config.js';
import { MeetStorageService } from '../../../../src/services/index.js';
import { expectValidationError } from '../../../helpers/assertion-helpers.js';
import { generateApiKey, getApiKeys, loginUser, startTestServer } from '../../../helpers/request-helpers.js';
@ -177,6 +179,12 @@ describe('Authentication API Tests', () => {
adminCookie = await loginUser();
});
afterAll(async () => {
// Restore API key
const storageService = container.get(MeetStorageService);
await storageService['initializeApiKey']();
});
const getRoomsWithApiKey = async (apiKey: string) => {
return request(app)
.get(`${INTERNAL_CONFIG.API_BASE_PATH_V1}/rooms`)