-
Notifications
You must be signed in to change notification settings - Fork 1
/
jest.setup.js
43 lines (38 loc) · 974 Bytes
/
jest.setup.js
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
const fetchMock = require('fetch-mock')
fetchMock.config.sendAsJson = false
const fs = require('fs')
global.__global = {
env: {
URL: 'http://localhost:5000',
isProd: false
// ...require('dotenv').config().parsed
}
}
fetchMock.get(
'http://localhost:5000/.netlify/functions/swimapi',
fs.readFileSync(__dirname + '/src/__tests__/data/data.json', 'utf8')
)
fetchMock.get(
'http://localhost:5000/assets/data/new_build.csv',
fs.readFileSync(__dirname + '/src/__tests__/data/new_build.csv', 'utf8')
)
jest.mock('mapbox-gl/dist/mapbox-gl', () => {
return {
default: {
accessToken: '',
GeolocateControl: jest.fn(),
Map: jest.fn(() => ({
addControl: jest.fn(),
on: jest.fn(),
remove: jest.fn(),
fitBounds: jest.fn(),
flyTo: jest.fn()
})),
NavigationControl: jest.fn(),
Marker: jest.fn(() => ({
setLngLat: jest.fn(),
addTo: jest.fn()
}))
}
}
})