From 956da35a07fb8f35013afd473f7a23d69aecc572 Mon Sep 17 00:00:00 2001 From: Max Bischof Date: Wed, 15 Jan 2025 15:10:48 +0100 Subject: [PATCH] Creat new mock adapter for every test --- .../controller/api-test/user-login-migration.api.spec.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/server/src/modules/user-login-migration/controller/api-test/user-login-migration.api.spec.ts b/apps/server/src/modules/user-login-migration/controller/api-test/user-login-migration.api.spec.ts index f0efed9e00..b5c58ecfe4 100644 --- a/apps/server/src/modules/user-login-migration/controller/api-test/user-login-migration.api.spec.ts +++ b/apps/server/src/modules/user-login-migration/controller/api-test/user-login-migration.api.spec.ts @@ -45,7 +45,6 @@ jest.mock('jwks-rsa', () => () => { describe('UserLoginMigrationController (API)', () => { let app: INestApplication; let em: EntityManager; - let axiosMock: MockAdapter; let testApiClient: TestApiClient; let configService: ConfigService; @@ -56,7 +55,6 @@ describe('UserLoginMigrationController (API)', () => { imports: [ServerTestModule], }).compile(); - axiosMock = new MockAdapter(axios); app = moduleRef.createNestApplication(); await app.init(); em = app.get(EntityManager); @@ -435,6 +433,8 @@ describe('UserLoginMigrationController (API)', () => { targetUserId: string, officialSchoolNumber: string ) => { + const axiosMock = new MockAdapter(axios); + axiosMock .onPost(targetSystem.oauthConfig?.tokenEndpoint) .replyOnce(200, {