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

Remove Enzyme tests in favour of React testing-library (#10289)

This commit is contained in:
Michael Telatynski
2023-03-06 12:13:17 +00:00
committed by GitHub
parent 303b878b17
commit 667ec166d7
10 changed files with 432 additions and 3163 deletions

View File

@ -15,8 +15,6 @@ limitations under the License.
*/
import { render, waitFor, screen } from "@testing-library/react";
// eslint-disable-next-line deprecate/import
import { mount, ReactWrapper } from "enzyme";
import { ReceiptType } from "matrix-js-sdk/src/@types/read_receipts";
import {
EventTimelineSet,
@ -38,7 +36,7 @@ import {
ThreadEvent,
ThreadFilterType,
} from "matrix-js-sdk/src/models/thread";
import React from "react";
import React, { createRef } from "react";
import TimelinePanel from "../../../src/components/structures/TimelinePanel";
import MatrixClientContext from "../../../src/contexts/MatrixClientContext";
@ -137,15 +135,17 @@ describe("TimelinePanel", () => {
// Create a TimelinePanel with ev0 already present
const timelineSet = new EventTimelineSet(room, {});
timelineSet.addLiveEvent(ev0);
const component: ReactWrapper<TimelinePanel> = mount(
const ref = createRef<TimelinePanel>();
render(
<TimelinePanel
timelineSet={timelineSet}
manageReadMarkers={true}
manageReadReceipts={true}
eventId={ev0.getId()}
ref={ref}
/>,
);
const timelinePanel = component.instance() as TimelinePanel;
const timelinePanel = ref.current!;
// An event arrived, and we read it
timelineSet.addLiveEvent(ev1);