import { afterAll, afterEach, beforeAll, beforeEach, vitest } from 'vitest'; import { server } from './mocks/server'; beforeAll(() => server.listen({ onUnhandledRequest: 'error' })); beforeEach(() => { const mockIntersectionObserver = vitest.fn(); mockIntersectionObserver.mockReturnValue({ observe: () => this, unobserve: () => this, disconnect: () => this, }); window.IntersectionObserver = mockIntersectionObserver; }) afterAll(() => server.close()); afterEach(() => server.resetHandlers());