1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-08-07 21:23:00 +03:00

Add filter console test util (#9607)

This commit is contained in:
Michael Weimann
2022-11-23 09:01:42 +01:00
committed by GitHub
parent 40cbee60db
commit 569a364933
3 changed files with 62 additions and 1 deletions

View File

@@ -22,7 +22,7 @@ import { MatrixClient, createClient } from "matrix-js-sdk/src/matrix";
import ForgotPassword from "../../../../src/components/structures/auth/ForgotPassword";
import { ValidatedServerConfig } from "../../../../src/utils/ValidatedServerConfig";
import { flushPromisesWithFakeTimers, stubClient } from "../../../test-utils";
import { filterConsole, flushPromisesWithFakeTimers, stubClient } from "../../../test-utils";
import Modal from "../../../../src/Modal";
import AutoDiscoveryUtils from "../../../../src/utils/AutoDiscoveryUtils";
@@ -39,6 +39,7 @@ describe("<ForgotPassword>", () => {
let serverConfig: ValidatedServerConfig;
let onComplete: () => void;
let renderResult: RenderResult;
let restoreConsole: () => void;
const typeIntoField = async (label: string, value: string): Promise<void> => {
await act(async () => {
@@ -55,6 +56,13 @@ describe("<ForgotPassword>", () => {
};
beforeEach(() => {
restoreConsole = filterConsole(
// not implemented by js-dom https://github.com/jsdom/jsdom/issues/1937
"Not implemented: HTMLFormElement.prototype.requestSubmit",
// not of interested for this test
"Starting load of AsyncWrapper for modal",
);
client = stubClient();
mocked(createClient).mockReturnValue(client);
@@ -70,6 +78,7 @@ describe("<ForgotPassword>", () => {
afterEach(() => {
// clean up modals
Modal.closeCurrentModal("force");
restoreConsole?.();
});
beforeAll(() => {