From 294d51f9adb21ac925828638915ac820db2c7a76 Mon Sep 17 00:00:00 2001 From: juancarmore Date: Wed, 27 Aug 2025 17:49:00 +0200 Subject: [PATCH] test: add cleanup step to restore API key after authentication tests --- backend/tests/integration/api/security/auth.test.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/backend/tests/integration/api/security/auth.test.ts b/backend/tests/integration/api/security/auth.test.ts index 149744d..e1e180a 100644 --- a/backend/tests/integration/api/security/auth.test.ts +++ b/backend/tests/integration/api/security/auth.test.ts @@ -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`)