Files
repro-tools/tests/components/workbench.test.tsx
T
2026-09-01 13:04:50 +02:00

31 lines
1.1 KiB
TypeScript

import { render, screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { describe, expect, it } from "vitest";
import { Workbench } from "../../src/components/Workbench";
describe("Workbench", () => {
it("builds a local manifest for selected files", async () => {
const user = userEvent.setup();
render(<Workbench />);
const input = document.querySelector('input[type="file"]');
expect(input).not.toBeNull();
await user.upload(
input as HTMLInputElement,
new File(["Ada"], "ada.txt", { type: "text/plain" }),
);
await user.click(screen.getByRole("button", { name: "Build manifest" }));
expect(await screen.findByText(/Manifest ready/u)).toBeVisible();
expect(
(screen.getByLabelText("Generated manifest") as HTMLTextAreaElement)
.value,
).toContain('"path": "ada.txt"');
});
it("starts with timestamping disabled", () => {
render(<Workbench />);
expect(
screen.getByRole("checkbox", { name: /current timestamp/u }),
).not.toBeChecked();
});
});