src/setupTests.js
// jest-dom adds custom jest matchers for asserting on DOM nodes.
// allows you to do things like:
// expect(element).toHaveTextContent(/react/i)
// learn more: https://github.com/testing-library/jest-dom
import "@testing-library/jest-dom/extend-expect";
// Render react portals as inline elements
// This causes snapshots to render a bit different than regular views
// But it's consistent and works as expected
jest.mock("react-dom", () => {
const original = jest.requireActual("react-dom");
return {
...original,
createPortal: (node) => node,
};
});