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', () => ({
18 loadCryptoWorker: jest.fn(),
21 // Silence JDOM warnings triggered by emoji-mart
22 HTMLCanvasElement.prototype.getContext = jest.fn()
24 jest.mock('@proton/shared/lib/i18n/dateFnLocales', () => ({
28 jest.mock('@proton/shared/lib/pow/wasmWorkerWrapper.ts', () => ({
32 jest.mock('@proton/shared/lib/pow/pbkdfWorkerWrapper.ts', () => ({
36 jest.mock('@proton/drive-store/store/_downloads/fileSaver/download.ts', () => {
38 initDownloadSW: jest.fn().mockResolvedValue(true),
42 jest.mock('@proton/drive-store/store/_uploads/initUploadFileWorker.ts', () => {
44 initUploadFileWorker: jest.fn(),
48 jest.mock('@proton/drive-store/utils/metrics/userSuccessMetrics.ts', () => {