-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.setup.ts
22 lines (19 loc) · 890 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
/*
This file contains common setup logic to be executed before running each test file in Jest.
It initializes any necessary configurations, mocks, or environment setups required for testing purposes.
Developers can define global setup functions, such as setting up mock modules or configuring test environments,
to ensure consistent behavior across all tests in the project.
*/
import '@testing-library/jest-dom';
// do setup once, for entire other test files also
//This setup is necessary because IntersectionObserver isn't available in the test environment
beforeAll(() => {
// IntersectionObserver isn't available in test environment
const mockIntersectionObserver = jest.fn();
mockIntersectionObserver.mockReturnValue({
observe: () => null,
unobserve: () => null,
disconnect: () => null,
});
window.IntersectionObserver = mockIntersectionObserver;
});