Merge branch 'INDA-330-pii-update' into 'main'
[ProtonMail-WebClient.git] / applications / pass / jest.setup.js
blob649826ad7ac179b60f36e5e706986102941386f4
1 import '@testing-library/jest-dom';
2 import { TextDecoder, TextEncoder } from 'util';
4 import '@proton/testing/lib/mockMatchMedia';
5 import '@proton/testing/lib/mockUnleash';
7 // Getting ReferenceError: TextDecoder is not defined without
8 global.TextEncoder = TextEncoder;
9 global.TextDecoder = TextDecoder;
11 // JSDom does not include a full implementation of webcrypto
12 const crypto = require('crypto').webcrypto;
13 global.crypto.subtle = crypto.subtle;
15 // Do not start crypto worker pool, let the single tests setup/mock the CryptoProxy as needed
16 jest.mock('@proton/shared/lib/helpers/setupCryptoWorker', () => ({
17 __esModule: true,
18 loadCryptoWorker: jest.fn(),
19 }));
21 // Silence JDOM warnings triggered by emoji-mart
22 HTMLCanvasElement.prototype.getContext = jest.fn();
24 jest.mock('@proton/shared/lib/i18n/dateFnLocales', () => ({
25 __esModule: true,
26 }));
28 jest.mock('@proton/shared/lib/pow/wasmWorkerWrapper.ts', () => ({
29 __esModule: true,
30 }));
32 jest.mock('@proton/shared/lib/pow/pbkdfWorkerWrapper.ts', () => ({
33 __esModule: true,
34 }));
36 jest.mock('loglevel');