-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjest.setup.ts
30 lines (24 loc) · 960 Bytes
/
jest.setup.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
// jest.setup.ts
global.IntersectionObserver = class IntersectionObserver {
constructor(public callback: (entries: any[], observer: IntersectionObserver) => void) {
// Store references to the observed elements
this.elements = new Set();
}
// Method to start observing an element
observe(target: Element): void {
this.elements.add(target);
// Mock implementation for when an element is observed
}
// Method to stop observing an element
unobserve(target: Element): void {
this.elements.delete(target);
// Mock implementation for when an element is unobserved
}
// Method to disconnect the observer (stop observing all elements)
disconnect(): void {
this.elements.clear();
// Mock implementation for when the observer is disconnected
}
// Add any additional methods or properties needed for your tests
private elements: Set<Element>;
} as any;