Files
healthchat-web/packages/shared-components/src/room-list/RoomListView/RoomListToast/RoomListToast.test.tsx
T
Florian Duros f4c62abbcd Room list: assign room to custom section (#33238)
* feat(sc): add new toast type for room list

* feat(sc): add section entries in room list item menu

* feat(rls): expose util functions

* feat: allows to tag room with custom sections

* feat(vm): add new Chat moved toast to room list vm

* feat(vm): add section selection to room list item vm

* feat(e2e): add tests for adding room in a custom section

* test(e2e): update existing screenshots

* chore: fix lint after merge

* chore: remove outline in test
2026-04-22 19:50:54 +00:00

37 lines
1.2 KiB
TypeScript

/*
* Copyright 2026 Element Creations Ltd.
*
* SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
* Please see LICENSE files in the repository root for full details.
*/
import React from "react";
import { render, screen } from "@test-utils";
import { composeStories } from "@storybook/react-vite";
import { describe, it, expect } from "vitest";
import userEvent from "@testing-library/user-event";
import * as stories from "./RoomListToast.stories";
const { SectionCreated, ChatMoved } = composeStories(stories);
describe("<RoomListToast />", () => {
it("renders SectionCreated story", () => {
const { container } = render(<SectionCreated />);
expect(container).toMatchSnapshot();
});
it("renders ChatMoved story", () => {
const { container } = render(<ChatMoved />);
expect(container).toMatchSnapshot();
});
it("calls onClose when the close button is clicked", async () => {
const user = userEvent.setup();
render(<SectionCreated />);
const closeButton = screen.getByRole("button", { name: "Close" });
await user.click(closeButton);
expect(SectionCreated.args.onClose).toHaveBeenCalled();
});
});