forked from stoplightio/elements
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetupTests.ts
35 lines (26 loc) · 850 Bytes
/
setupTests.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
import '@testing-library/jest-dom';
import fetchMock from 'jest-fetch-mock';
declare global {
interface Window {
ResizeObserver(entries: any[]): {
observe(el: HTMLElement): void;
unobserve(el: HTMLElement): void;
disconnect(): void;
};
}
}
const Enzyme = require('enzyme');
const Adapter = require('enzyme-adapter-react-16');
Enzyme.configure({ adapter: new Adapter() });
process.env.TZ = 'UTC';
Element.prototype.scrollTo = () => {};
window.IntersectionObserver = class implements IntersectionObserver {
readonly root!: Element | null;
readonly rootMargin!: string;
readonly thresholds!: ReadonlyArray<number>;
public readonly observe = jest.fn();
public readonly unobserve = jest.fn();
public readonly disconnect = jest.fn();
public readonly takeRecords = jest.fn();
};
fetchMock.enableMocks();