mirror of
https://github.com/jakejarvis/hoot.git
synced 2025-10-18 20:14:25 -04:00
15 lines
565 B
TypeScript
15 lines
565 B
TypeScript
/* @vitest-environment jsdom */
|
|
import { render, screen } from "@testing-library/react";
|
|
import userEvent from "@testing-library/user-event";
|
|
import { describe, expect, it, vi } from "vitest";
|
|
import { ErrorWithRetry } from "./error-with-retry";
|
|
|
|
describe("ErrorWithRetry", () => {
|
|
it("calls onRetry when clicking Retry", async () => {
|
|
const onRetry = vi.fn();
|
|
render(<ErrorWithRetry message="Failed" onRetryAction={onRetry} />);
|
|
await userEvent.click(screen.getByRole("button", { name: /retry/i }));
|
|
expect(onRetry).toHaveBeenCalled();
|
|
});
|
|
});
|