Make tests more resilient for React 18 upgrade (#12861)
* Make tests more resilient for React 18 upgrade Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Delint Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --------- Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
4e4c5c7768
commit
8285283cc3
35 changed files with 313 additions and 290 deletions
|
@ -19,6 +19,7 @@ import { fireEvent, render, waitFor } from "@testing-library/react";
|
|||
import { LocationAssetType, ClientEvent, RoomMember, SyncState } from "matrix-js-sdk/src/matrix";
|
||||
import * as maplibregl from "maplibre-gl";
|
||||
import { logger } from "matrix-js-sdk/src/logger";
|
||||
import { sleep } from "matrix-js-sdk/src/utils";
|
||||
|
||||
import MLocationBody from "../../../../src/components/views/messages/MLocationBody";
|
||||
import MatrixClientContext from "../../../../src/contexts/MatrixClientContext";
|
||||
|
@ -64,9 +65,11 @@ describe("MLocationBody", () => {
|
|||
});
|
||||
const component = getComponent();
|
||||
|
||||
// simulate error initialising map in maplibregl
|
||||
// @ts-ignore
|
||||
mockMap.emit("error", { status: 404 });
|
||||
sleep(10).then(() => {
|
||||
// simulate error initialising map in maplibregl
|
||||
// @ts-ignore
|
||||
mockMap.emit("error", { status: 404 });
|
||||
});
|
||||
|
||||
return component;
|
||||
};
|
||||
|
@ -100,9 +103,10 @@ describe("MLocationBody", () => {
|
|||
expect(component.container.querySelector(".mx_EventTile_body")).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("displays correct fallback content when map_style_url is misconfigured", () => {
|
||||
it("displays correct fallback content when map_style_url is misconfigured", async () => {
|
||||
const component = getMapErrorComponent();
|
||||
expect(component.container.querySelector(".mx_EventTile_body")).toMatchSnapshot();
|
||||
await waitFor(() => expect(component.container.querySelector(".mx_EventTile_body")).toBeTruthy());
|
||||
await waitFor(() => expect(component.container.querySelector(".mx_EventTile_body")).toMatchSnapshot());
|
||||
});
|
||||
|
||||
it("should clear the error on reconnect", () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue