-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathsetupTests.ts
More file actions
58 lines (51 loc) · 2.36 KB
/
setupTests.ts
File metadata and controls
58 lines (51 loc) · 2.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import { afterEach, vi } from 'vitest'
import { cleanup } from '@testing-library/react'
// extends Vitest's expect method with methods from react-testing-library
import '@testing-library/jest-dom/vitest'
const localhost = 'http://localhost:3000/0.0'
export const testConfigs = {
NODE_ENV: 'test',
STAGE: 'DEV',
AUTHORIZATION_SERVER_TOKEN_CREATION_URL: 'https://auth.dev.interop.pagopa.it/token.oauth2',
SELFCARE_LOGIN_URL: 'https://uat.selfcare.pagopa.it/',
SELFCARE_BASE_URL: 'https://uat.selfcare.pagopa.it',
INTEROP_RESOURCES_BASE_URL: 'https://interop-public-assets-dev.s3.eu-south-1.amazonaws.com',
BACKEND_FOR_FRONTEND_URL: `${localhost}/backend-for-frontend`,
MIXPANEL_PROJECT_ID: 'b6c8c3c3ed0b32d66c61593bcb84e705',
ONETRUST_DOMAIN_SCRIPT_ID: '018ef6c1-31f6-70a6-bf72-ds7d45c0ade7e',
CLIENT_ASSERTION_JWT_AUDIENCE: '',
M2M_JWT_AUDIENCE: 'dev.interop.pagopa.it/m2m',
WELL_KNOWN_URLS: 'https://dev.interop.pagopa.it/.well-known/jwks.json',
PRODUCER_ALLOWED_ORIGINS:
'IPA,ANAC,IVASS,INFOCAMERE,SELC,SELC-PT,PDND_INFOCAMERE-SCP,PDND_INFOCAMERE-PRV,PDND_INFOCAMERE-PT,INFOCAMERE-PT',
DELEGATIONS_ALLOWED_ORIGINS: 'IPA',
PUBLIC_URL: '/ui',
FEATURE_FLAG_ADMIN_CLIENT: 'true',
FEATURE_FLAG_AGREEMENT_APPROVAL_POLICY_UPDATE: 'true',
SIGNALHUB_PERSONAL_DATA_PROCESS_URL: 'http://localhost',
FEATURE_FLAG_ESERVICE_PERSONAL_DATA: 'true',
FEATURE_FLAG_USE_SIGNED_DOCUMENT: 'true',
DOCUMENTATION_URL:
'https://developer.pagopa.it/pdnd-interoperabilita/guides/manuale-operativo-pdnd-interoperabilita/v1.0',
AVATAR_BASEPATH: 'http://selc-u-checkout-cdn-endpoint.azureedge.net',
SELFCARE_PRODUCT_ID: 'prod-interop',
}
// runs a cleanup after each test case (e.g. clearing jsdom)
afterEach(() => {
cleanup()
})
// vi.spyOn(global.console, 'log').mockImplementation(() => vi.fn())
vi.spyOn(global.console, 'error').mockImplementation(() => vi.fn())
vi.spyOn(global.console, 'warn').mockImplementation(() => vi.fn())
global.crypto.randomUUID = () =>
Math.random().toString() as `${string}-${string}-${string}-${string}-${string}`
vi.stubGlobal('scroll', vi.fn())
vi.stubGlobal('pagopa_env', testConfigs)
vi.mock('zustand')
vi.mock('react-i18next')
process.env = {
...process.env,
// This is needed in order to make the tests work.
// The chosen REACT_APP_API_HOST value is random and could be any string.
REACT_APP_API_HOST: 'http://localhost:8080',
}