mirror of
https://github.com/Novaloop-AG/healthchat-web.git
synced 2026-11-10 09:15:16 +00:00
f4c62abbcd
* 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
37 lines
1.2 KiB
TypeScript
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();
|
|
});
|
|
});
|