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

Commit

Permalink
Fix type errors in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
weeman1337 committed Mar 3, 2023
1 parent bc93548 commit 35ac4c7
Showing 1 changed file with 1 addition and 18 deletions.
19 changes: 1 addition & 18 deletions test/components/views/right_panel/UserInfo-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -556,23 +556,6 @@ describe("<UserOptionsSection />", () => {
});
});

it("calling .invite with a null roomId still calls .invite and shows default error message", async () => {
inviteSpy.mockRejectedValue({ this: "could be anything" });

// render the component and click the button
renderComponent({ canInvite: true, member: new RoomMember(null, defaultUserId) });
const inviteButton = screen.getByRole("button", { name: /invite/i });
expect(inviteButton).toBeInTheDocument();
await userEvent.click(inviteButton);

expect(inviteSpy).toHaveBeenCalledTimes(1);

// check that the default test error message is displayed
await waitFor(() => {
expect(screen.getByText(/operation failed/i)).toBeInTheDocument();
});
});

it("shows a modal before ignoring the user", async () => {
const originalCreateDialog = Modal.createDialog;
const modalSpy = (Modal.createDialog = jest.fn().mockReturnValue({
Expand Down Expand Up @@ -624,7 +607,7 @@ describe("<UserOptionsSection />", () => {
["for a User", defaultUser, defaultUser.avatarUrl],
])(
"clicking »message« %s should start a DM",
async (test: string, member: RoomMember | User, expectedAvatarUrl: string) => {
async (test: string, member: RoomMember | User, expectedAvatarUrl: string | undefined) => {
renderComponent({ member });
await userEvent.click(screen.getByText("Message"));
expect(startDmOnFirstMessage).toHaveBeenCalledWith(mockClient, [
Expand Down

0 comments on commit 35ac4c7

Please sign in to comment.