Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Migrate useTopic test to RTL (#9580)
Browse files Browse the repository at this point in the history
  • Loading branch information
Germain authored Nov 15, 2022
1 parent c10339a commit 663c7e0
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions test/useTopic-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -46,9 +45,9 @@ describe("useTopic", () => {
return <p>{ topic.text }</p>;
}

const wrapper = mount(<RoomTopic />);
render(<RoomTopic />);

expect(wrapper.text()).toBe("Test topic");
expect(screen.queryByText("Test topic")).toBeInTheDocument();

const updatedTopic = mkEvent({
type: 'm.room.topic',
Expand All @@ -65,6 +64,6 @@ describe("useTopic", () => {
room.addLiveEvents([updatedTopic]);
});

expect(wrapper.text()).toBe("New topic");
expect(screen.queryByText("New topic")).toBeInTheDocument();
});
});

0 comments on commit 663c7e0

Please sign in to comment.