Make tests happier
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
4367299885
commit
7fe11a6026
7 changed files with 21 additions and 5 deletions
|
@ -25,10 +25,7 @@ const config: Config = {
|
|||
},
|
||||
testMatch: ["<rootDir>/test/**/*-test.[tj]s?(x)"],
|
||||
setupFiles: ["jest-canvas-mock"],
|
||||
setupFilesAfterEnv: [
|
||||
"<rootDir>/node_modules/matrix-react-sdk/test/setupTests.ts",
|
||||
"<rootDir>/test/setup/setupLanguage.ts",
|
||||
],
|
||||
setupFilesAfterEnv: ["<rootDir>/node_modules/matrix-react-sdk/test/setupTests.ts"],
|
||||
moduleNameMapper: {
|
||||
"\\.(css|scss|pcss)$": "<rootDir>/__mocks__/cssMock.js",
|
||||
"\\.(gif|png|ttf|woff2)$": "<rootDir>/node_modules/matrix-react-sdk/__mocks__/imageMock.js",
|
||||
|
|
|
@ -25,6 +25,6 @@ fetchMock.config.overwriteRoutes = false;
|
|||
|
||||
export function setupLanguageMock() {
|
||||
reactSetupLanguageMock();
|
||||
fetchMock.get("end:en_EN.json", _.merge(en, reactEn), { overwriteRoutes: true });
|
||||
fetchMock.get("end:en_EN.json", _.merge({}, en, reactEn), { overwriteRoutes: true });
|
||||
}
|
||||
setupLanguageMock();
|
||||
|
|
|
@ -18,8 +18,13 @@ import * as React from "react";
|
|||
import { render } from "@testing-library/react";
|
||||
|
||||
import ErrorView from "../../../../src/async-components/structures/ErrorView";
|
||||
import { setupLanguageMock } from "../../../setup/setupLanguage";
|
||||
|
||||
describe("<ErrorView />", () => {
|
||||
beforeEach(() => {
|
||||
setupLanguageMock();
|
||||
});
|
||||
|
||||
it("should match snapshot", () => {
|
||||
const { asFragment } = render(<ErrorView title="TITLE" messages={["MSG1", "MSG2"]} />);
|
||||
expect(asFragment()).toMatchSnapshot();
|
||||
|
|
|
@ -18,8 +18,13 @@ import * as React from "react";
|
|||
import { render } from "@testing-library/react";
|
||||
|
||||
import VectorAuthFooter from "../../../../../src/components/views/auth/VectorAuthFooter";
|
||||
import { setupLanguageMock } from "../../../../setup/setupLanguage";
|
||||
|
||||
describe("<VectorAuthFooter />", () => {
|
||||
beforeEach(() => {
|
||||
setupLanguageMock();
|
||||
});
|
||||
|
||||
it("should match snapshot", () => {
|
||||
const { asFragment } = render(<VectorAuthFooter />);
|
||||
expect(asFragment()).toMatchSnapshot();
|
||||
|
|
|
@ -18,8 +18,13 @@ import * as React from "react";
|
|||
import { render } from "@testing-library/react";
|
||||
|
||||
import VectorAuthPage from "../../../../../src/components/views/auth/VectorAuthPage";
|
||||
import { setupLanguageMock } from "../../../../setup/setupLanguage";
|
||||
|
||||
describe("<VectorAuthPage />", () => {
|
||||
beforeEach(() => {
|
||||
setupLanguageMock();
|
||||
});
|
||||
|
||||
it("should match snapshot", () => {
|
||||
const { asFragment } = render(<VectorAuthPage />);
|
||||
expect(asFragment()).toMatchSnapshot();
|
||||
|
|
|
@ -26,6 +26,7 @@ import DesktopCapturerSourcePicker from "matrix-react-sdk/src/components/views/e
|
|||
import { mocked } from "jest-mock";
|
||||
|
||||
import ElectronPlatform from "../../../../src/vector/platform/ElectronPlatform";
|
||||
import { setupLanguageMock } from "../../../setup/setupLanguage";
|
||||
|
||||
jest.mock("matrix-react-sdk/src/rageshake/rageshake", () => ({
|
||||
flush: jest.fn(),
|
||||
|
@ -51,6 +52,7 @@ describe("ElectronPlatform", () => {
|
|||
window.electron = mockElectron;
|
||||
jest.clearAllMocks();
|
||||
Object.defineProperty(window, "navigator", { value: { userAgent: defaultUserAgent }, writable: true });
|
||||
setupLanguageMock();
|
||||
});
|
||||
|
||||
const getElectronEventHandlerCall = (eventType: string): [type: string, handler: Function] | undefined =>
|
||||
|
|
|
@ -19,12 +19,14 @@ import { UpdateCheckStatus } from "matrix-react-sdk/src/BasePlatform";
|
|||
import { MatrixClientPeg } from "matrix-react-sdk/src/MatrixClientPeg";
|
||||
|
||||
import WebPlatform from "../../../../src/vector/platform/WebPlatform";
|
||||
import { setupLanguageMock } from "../../../setup/setupLanguage";
|
||||
|
||||
fetchMock.config.overwriteRoutes = true;
|
||||
|
||||
describe("WebPlatform", () => {
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
||||
setupLanguageMock();
|
||||
});
|
||||
|
||||
it("returns human readable name", () => {
|
||||
|
|
Loading…
Reference in a new issue