Farmbot-Web-App/frontend/demo/__tests__/index_test.tsx

34 lines
855 B
TypeScript

jest.mock("../../util/stop_ie", () => ({
stopIE: jest.fn()
}));
jest.mock("../../util", () => ({
attachToRoot: jest.fn()
}));
jest.mock("../../i18n", () => ({
detectLanguage: jest.fn(() => Promise.resolve({}))
}));
jest.mock("i18next", () => ({
init: jest.fn((_: {}, fn: Function) => fn())
}));
import { stopIE } from "../../util/stop_ie";
import { attachToRoot } from "../../util";
import { detectLanguage } from "../../i18n";
import { DemoIframe } from "../demo_iframe";
import I from "i18next";
describe("DemoIframe loader", () => {
it("calls expected callbacks", (done) => {
import("../index").then(() => {
expect(stopIE).toHaveBeenCalled();
expect(detectLanguage).toHaveBeenCalled();
expect(I.init).toHaveBeenCalled();
expect(attachToRoot).toHaveBeenCalledWith(DemoIframe);
done();
});
});
});