Skip to content

Commit

Permalink
👍 use composeStories
Browse files Browse the repository at this point in the history
  • Loading branch information
nus3 committed Apr 17, 2024
1 parent 6a108af commit d5d54eb
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions apps/react-vitest/src/components/Toast/Toast.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@ import { act, render, screen } from "@testing-library/react";
import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";

import { userEventSetup } from "../../../test/helpers/userEventSetup";
import { AUTO_CLOSE_TIME, TOAST_ANIMATION_TIME, Toast } from "./Toast";
import { AUTO_CLOSE_TIME, TOAST_ANIMATION_TIME } from "./Toast";
import { composeStories } from "@storybook/react";

import * as ToastStories from "./Toast.stories";

const { Default } = composeStories(ToastStories);

describe("Toast", () => {
beforeEach(() => {
Expand All @@ -17,7 +22,7 @@ describe("Toast", () => {
test("should be show and hide toast", async () => {
const user = userEventSetup();

render(<Toast>Hello nus3!</Toast>);
render(<Default />);
expect(screen.queryByRole("alert")).toBeNull();

await user.click(screen.getByRole("button"));
Expand Down

0 comments on commit d5d54eb

Please sign in to comment.