@@ -18,8 +18,23 @@ describe("Workbench", () => {
|
||||
it("shows malformed decoder errors without clearing bytes", async () => {
|
||||
const user = userEvent.setup();
|
||||
render(<Workbench />);
|
||||
await user.click(screen.getByRole("tab", { name: "ASN.1 DER" }));
|
||||
await user.click(screen.getByRole("button", { name: "ASN.1 DER" }));
|
||||
expect(screen.getByRole("alert")).toBeVisible();
|
||||
expect(screen.getByRole("button", { name: "Byte 20: 0a" })).toBeVisible();
|
||||
});
|
||||
|
||||
it("edits and searches the canonical byte buffer", async () => {
|
||||
const user = userEvent.setup();
|
||||
render(<Workbench />);
|
||||
const editOffset = screen.getAllByLabelText("Offset (decimal or 0x…)")[0]!;
|
||||
await user.clear(editOffset);
|
||||
await user.type(editOffset, "0");
|
||||
await user.type(screen.getByLabelText("Replacement bytes (hex)"), "41");
|
||||
await user.click(screen.getByRole("button", { name: "Apply byte edit" }));
|
||||
expect(
|
||||
(screen.getByLabelText("hex output") as HTMLTextAreaElement).value,
|
||||
).toMatch(/^41/u);
|
||||
await user.click(screen.getByRole("button", { name: "Search" }));
|
||||
expect(await screen.findByText(/1 match/u)).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user