-
Notifications
You must be signed in to change notification settings - Fork 1.8k
/
Copy pathjest.setup.js
30 lines (23 loc) · 915 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
// SPDX-License-Identifier: MIT
// Copyright contributors to the kepler.gl project
import '@testing-library/jest-dom';
// Disable polyfills as // ReferenceError: ReadableStream is not defined in @loaders.gl/polyfills
// import {installFilePolyfills} from '@loaders.gl/polyfills';
// installFilePolyfills();
// Remove once @loaders.gl/polyfills are reenabled
const {TextDecoder, TextEncoder} = require('node:util');
Object.defineProperties(globalThis, {
TextDecoder: {value: TextDecoder},
TextEncoder: {value: TextEncoder}
});
jest.mock('mapbox-gl/dist/mapbox-gl', () => ({
Map: () => ({})
}));
jest.mock('@kepler.gl/utils', () => ({
...jest.requireActual('@kepler.gl/utils'),
hasPortableWidth: jest.fn(),
hasMobileWidth: jest.fn()
}));
// @loaders.gl/parquet isn't tested in jest atm, and is generating errors
jest.mock('@loaders.gl/parquet', () => ({}));
global.URL.createObjectURL = jest.fn();