forked from founder-srm/foundathon_landing
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvitest.setup.ts
More file actions
34 lines (24 loc) · 810 Bytes
/
vitest.setup.ts
File metadata and controls
34 lines (24 loc) · 810 Bytes
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
import "@testing-library/jest-dom/vitest";
class MockIntersectionObserver implements IntersectionObserver {
readonly root: Element | Document | null = null;
readonly rootMargin = "0px";
readonly thresholds = [0];
disconnect() {}
observe(_target: Element) {}
takeRecords(): IntersectionObserverEntry[] {
return [];
}
unobserve(_target: Element) {}
}
if (typeof globalThis.IntersectionObserver === "undefined") {
globalThis.IntersectionObserver =
MockIntersectionObserver as typeof IntersectionObserver;
}
class MockResizeObserver implements ResizeObserver {
disconnect() {}
observe(_target: Element) {}
unobserve(_target: Element) {}
}
if (typeof globalThis.ResizeObserver === "undefined") {
globalThis.ResizeObserver = MockResizeObserver as typeof ResizeObserver;
}