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("keeps conversion views synchronized", async () => { const user = userEvent.setup(); render(); const source = screen.getByLabelText("Encoded input"); await user.clear(source); await user.type(source, "Ada"); await user.click(screen.getByRole("button", { name: "Apply input" })); expect(screen.getByLabelText("hex output")).toHaveValue("416461"); expect(screen.getByLabelText("base64 output")).toHaveValue("QWRh"); }); it("shows malformed decoder errors without clearing bytes", async () => { const user = userEvent.setup(); render(); await user.click(screen.getByRole("tab", { name: "ASN.1 DER" })); expect(screen.getByRole("alert")).toBeVisible(); expect(screen.getByRole("button", { name: "Byte 20: 0a" })).toBeVisible(); }); });