forked from cowprotocol/cowswap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjest.setup.ts
32 lines (25 loc) · 916 Bytes
/
jest.setup.ts
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
import { config } from 'dotenv'
import 'jest-styled-components' // include style rules in snapshots
import fetchMock from 'jest-fetch-mock' // Mocks `fetch` calls in unittests
import { Readable } from 'stream'
import { TextDecoder, TextEncoder } from 'util'
// For simplicity, we will use CowSwap default .env for all projects and libs
config({ path: __dirname + '/apps/cowswap-frontend/.env' })
if (typeof global.TextEncoder === 'undefined') {
global.ReadableStream = Readable as unknown as typeof globalThis.ReadableStream
global.TextEncoder = TextEncoder
global.TextDecoder = TextDecoder as typeof global.TextDecoder
}
fetchMock.dontMock()
jest.mock('react-markdown', () => () => null)
jest.mock('lottie-react', () => () => null)
jest.mock('quick-lru', () => {
return {
__esModule: true,
default: class MockQuickLRU extends Map {
constructor() {
super()
}
},
}
})