aboutsummaryrefslogtreecommitdiffstats
path: root/jest.setup.js
blob: 92c6c3b4a1a15cf6305ac1814a0d21f77396762e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import { jest } from '@jest/globals';
import '@testing-library/jest-dom/jest-globals';
import nextRouterMock from 'next-router-mock';
import './tests/jest/__mocks__/matchMedia.mock';

jest.mock('next/router', () => nextRouterMock);
jest.mock('next/dynamic', () => () => 'dynamic-import');

/* Jest complains about "Must use import to load ES Module" when importing
 * unified and rehype modules. Maybe it is not the right way to avoid those
 * errors but for now it is the only things that work. */
jest.mock('src/utils/helpers/rehype.ts', () => {
  return {
    __esModule: true,
    updateContentTree: jest.fn((str) => str),
  };
});