-
Notifications
You must be signed in to change notification settings - Fork 3
/
setup-jest.ts
42 lines (35 loc) · 1.19 KB
/
setup-jest.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
33
34
35
36
37
38
39
40
41
42
import 'jest-preset-angular/setup-jest';
import './projects/app/src/polyfills';
import '@testing-library/jest-dom';
import { TextEncoder, TextDecoder } from 'util';
import * as failOnConsole from 'jest-fail-on-console';
failOnConsole();
global.TextEncoder = TextEncoder;
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
global.TextDecoder = TextDecoder;
window.ResizeObserver =
window.ResizeObserver ||
jest.fn().mockImplementation(() => ({
disconnect: jest.fn(),
observe: jest.fn(),
unobserve: jest.fn(),
}));
window.EventSource = window.EventSource || jest.fn().mockImplementation(() => ({
close: jest.fn(),
}));
Element.prototype.scrollTo = Element.prototype.scrollTo || (() => {});
jest.mock('jsts/org/locationtech/jts/io', () => ({
// eslint-disable-next-line @typescript-eslint/naming-convention
OL3Parser: class MockedParser {
public inject() {/*empty*/}
public read(input: any) { return input; }
public write(input: any) { return input; }
},
}));
jest.mock('jsts/org/locationtech/jts/operation/buffer', () => ({
// eslint-disable-next-line @typescript-eslint/naming-convention
BufferOp: {
bufferOp: (input: any) => input,
},
}));