forked from olliethedev/ui-builder
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.setup.js
More file actions
81 lines (65 loc) · 1.62 KB
/
jest.setup.js
File metadata and controls
81 lines (65 loc) · 1.62 KB
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
// Learn more: https://github.com/testing-library/jest-dom
import "@testing-library/jest-dom";
jest.mock("remark-gfm", () => () => {
})
jest.mock("remark-math", () => () => {
})
jest.mock("lowlight", () => ({
common: {},
createLowlight: jest.fn(() => ({
highlight: jest.fn(() => ({ value: [] })),
highlightAuto: jest.fn(() => ({ value: [] })),
register: jest.fn(),
registered: jest.fn(() => true),
listLanguages: jest.fn(() => []),
})),
}));
jest.mock("react-medium-image-zoom", () => ({
__esModule: true,
default: ({ children }) => children,
Zoom: ({ children }) => children,
}));
jest.mock("next-themes", () => ({
useTheme: jest.fn(),
ThemeProvider: jest.fn(),
}));
class ResizeObserver {
constructor(callback) {
this.callback = callback;
}
observe() {
// Mock observe method
}
unobserve() {
// Mock unobserve method
}
disconnect() {
// Mock disconnect method
}
// Optionally, you can add a method to trigger the callback manually
trigger(entries) {
this.callback(entries);
}
}
class IntersectionObserver {
constructor(callback, options) {
this.callback = callback;
this.options = options;
}
observe() {
// Mock observe method - automatically trigger as visible for testing
this.callback([{ isIntersecting: true }]);
}
unobserve() {
// Mock unobserve method
}
disconnect() {
// Mock disconnect method
}
// Optionally, you can add a method to trigger the callback manually
trigger(entries) {
this.callback(entries);
}
}
global.ResizeObserver = ResizeObserver;
global.IntersectionObserver = IntersectionObserver;