bigbuffet-rw/app/soapbox/jest/test-setup.ts

18 lines
539 B
TypeScript
Raw Normal View History

'use strict';
import { __clear as clearApiMocks } from '../__mocks__/api';
// API mocking
jest.mock('soapbox/api');
afterEach(() => clearApiMocks());
2022-04-21 15:03:29 -07:00
// Mock IndexedDB
// https://dev.to/andyhaskell/testing-your-indexeddb-code-with-jest-2o17
require('fake-indexeddb/auto');
// Mock external dependencies
2022-04-21 10:24:54 -07:00
jest.mock('uuid', () => ({ v4: jest.fn(() => '1') }));
2022-04-06 07:10:21 -07:00
const intersectionObserverMock = () => ({ observe: () => null, disconnect: () => null });
window.IntersectionObserver = jest.fn().mockImplementation(intersectionObserverMock);