From 663c7e069e38b69d78181034098766d068ac3121 Mon Sep 17 00:00:00 2001 From: Germain Date: Tue, 15 Nov 2022 13:00:02 +0000 Subject: [PATCH] Migrate useTopic test to RTL (#9580) --- test/useTopic-test.tsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/test/useTopic-test.tsx b/test/useTopic-test.tsx index 818eb9fd71..6ce8a1fcb3 100644 --- a/test/useTopic-test.tsx +++ b/test/useTopic-test.tsx @@ -16,9 +16,8 @@ limitations under the License. import React from "react"; import { Room } from "matrix-js-sdk/src/models/room"; -// eslint-disable-next-line deprecate/import -import { mount } from "enzyme"; import { act } from "react-dom/test-utils"; +import { render, screen } from "@testing-library/react"; import { useTopic } from "../src/hooks/room/useTopic"; import { mkEvent, stubClient } from "./test-utils"; @@ -46,9 +45,9 @@ describe("useTopic", () => { return

{ topic.text }

; } - const wrapper = mount(); + render(); - expect(wrapper.text()).toBe("Test topic"); + expect(screen.queryByText("Test topic")).toBeInTheDocument(); const updatedTopic = mkEvent({ type: 'm.room.topic', @@ -65,6 +64,6 @@ describe("useTopic", () => { room.addLiveEvents([updatedTopic]); }); - expect(wrapper.text()).toBe("New topic"); + expect(screen.queryByText("New topic")).toBeInTheDocument(); }); });