summaryrefslogtreecommitdiff
path: root/client/src/setup.ts
blob: d72d646f3bf754e0b3e792079cb1a1a6a7f6e22c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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());