From 919e7539510241a80d054679e5ed1d54c858276f Mon Sep 17 00:00:00 2001 From: Marius Tobiassen Bungum Date: Thu, 23 Jan 2025 13:03:31 +0100 Subject: [PATCH 1/2] :adhesive_bandage: Don't run active impersonate user call if we're in prod --- .../ImpersonateMenu/hooks/useActiveImpersonationUser.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/organisms/TopBar/Account/ImpersonateMenu/hooks/useActiveImpersonationUser.ts b/src/organisms/TopBar/Account/ImpersonateMenu/hooks/useActiveImpersonationUser.ts index 97365007..f156cb78 100644 --- a/src/organisms/TopBar/Account/ImpersonateMenu/hooks/useActiveImpersonationUser.ts +++ b/src/organisms/TopBar/Account/ImpersonateMenu/hooks/useActiveImpersonationUser.ts @@ -5,6 +5,7 @@ import { import { useQuery } from '@tanstack/react-query'; import { ACTIVE_USERIMPERSONATION } from '../Impersonate.constants'; +import { environment } from 'src/atoms/utils/auth_environment'; export function useActiveImpersonationUser() { return useQuery({ @@ -25,5 +26,8 @@ export function useActiveImpersonationUser() { } } }, + enabled: + environment.getEnvironmentName(import.meta.env.VITE_ENVIRONMENT_NAME) !== + 'production', }); } From c5449f7633f58d339e91e3ee6c43aa1b34f48fdd Mon Sep 17 00:00:00 2001 From: Marius Tobiassen Bungum Date: Thu, 23 Jan 2025 14:42:30 +0100 Subject: [PATCH 2/2] :white_check_mark: Fix bad test env variable --- src/organisms/TopBar/Account/Account.jsdom.test.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/organisms/TopBar/Account/Account.jsdom.test.tsx b/src/organisms/TopBar/Account/Account.jsdom.test.tsx index 95b3f1ce..2b229945 100644 --- a/src/organisms/TopBar/Account/Account.jsdom.test.tsx +++ b/src/organisms/TopBar/Account/Account.jsdom.test.tsx @@ -1,3 +1,5 @@ +import { EnvironmentType } from '@equinor/subsurface-app-management'; + import { Account } from 'src/organisms/TopBar/Account/Account'; import { MOCK_USER } from 'src/providers/AuthProvider/AuthProvider'; import { @@ -57,6 +59,7 @@ describe('Active impersonation', () => { { once: true } ) ); + vi.stubEnv('VITE_ENVIRONMENT_NAME', EnvironmentType.DEVELOP); }); test('Active impersonation is set as selected', async () => {