app/src/setupTests.js (view raw)
1/* eslint-disable */
2// jest-dom adds custom jest matchers for asserting on DOM nodes.
3// allows you to do things like:
4// expect(element).toHaveTextContent(/react/i)
5// learn more: https://github.com/testing-library/jest-dom
6import '@testing-library/jest-dom/extend-expect';
7import './i18n';
8
9window.scrollTo = jest.fn();
10// FROM https://github.com/akiran/react-slick/blob/master/test-setup.js
11window.matchMedia =
12 window.matchMedia ||
13 (() => ({
14 matches: false,
15 addListener: () => {},
16 removeListener: () => {},
17 }));
18
19window.requestAnimationFrame =
20 window.requestAnimationFrame || (callback => setTimeout(callback, 0));
21
22global.createNodeMock = () => {
23 return {
24 focus: jest.fn(),
25 };
26};