forked from centreon/centreon-archived
-
Notifications
You must be signed in to change notification settings - Fork 1
/
setupTest.js
66 lines (54 loc) · 1.52 KB
/
setupTest.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import 'dayjs/locale/en';
import i18n from 'i18next';
import { initReactI18next } from 'react-i18next';
import dayjs from 'dayjs';
import timezonePlugin from 'dayjs/plugin/timezone';
import utcPlugin from 'dayjs/plugin/utc';
import localizedFormat from 'dayjs/plugin/localizedFormat';
import isToday from 'dayjs/plugin/isToday';
import isYesterday from 'dayjs/plugin/isYesterday';
import weekday from 'dayjs/plugin/weekday';
import isBetween from 'dayjs/plugin/isBetween';
import isSameOrBefore from 'dayjs/plugin/isSameOrBefore';
import ResizeObserver from 'resize-observer-polyfill';
window.ResizeObserver = ResizeObserver;
jest.setTimeout(10000);
dayjs.extend(localizedFormat);
dayjs.extend(utcPlugin);
dayjs.extend(timezonePlugin);
dayjs.extend(isToday);
dayjs.extend(isYesterday);
dayjs.extend(weekday);
dayjs.extend(isBetween);
dayjs.extend(isSameOrBefore);
document.createRange = () => ({
commonAncestorContainer: {
nodeName: 'BODY',
ownerDocument: document,
},
setEnd: () => {},
setStart: () => {},
});
class IntersectionObserver {
observe = jest.fn();
unobserve = jest.fn();
disconnect = jest.fn();
current = this;
}
Object.defineProperty(window, 'IntersectionObserver', {
configurable: true,
value: IntersectionObserver,
writable: true,
});
Object.defineProperty(global, 'IntersectionObserver', {
configurable: true,
value: IntersectionObserver,
writable: true,
});
i18n.use(initReactI18next).init({
fallbackLng: 'en',
keySeparator: false,
lng: 'en',
nsSeparator: false,
resources: {},
});