excalidraw/src/setupTests.ts
Aakansha Doshi 25ea97d0f9
test: fix failing tests and API (#5823)
* tests: fix failing tests

* fix selection.test.tsx

* fix excalidraw.test.tsx and don't show image export when SaveAsImage is false in UIOptions.canvasActions

* more fixes

* require fake index db in setUp test to fix the tests

* fix regression
2022-11-04 18:22:21 +05:30

24 lines
623 B
TypeScript

import "@testing-library/jest-dom";
import "jest-canvas-mock";
import dotenv from "dotenv";
import polyfill from "./polyfill";
require("fake-indexeddb/auto");
polyfill();
// jest doesn't know of .env.development so we need to init it ourselves
dotenv.config({
path: require("path").resolve(__dirname, "../.env.development"),
});
jest.mock("nanoid", () => {
return {
nanoid: jest.fn(() => "test-id"),
};
});
// ReactDOM is located inside index.tsx file
// as a result, we need a place for it to render into
const element = document.createElement("div");
element.id = "root";
document.body.appendChild(element);