test(web): add 23 edge-case tests across UI components and lib utils

Covers: aria-sort/aria-labelledby attributes, non-Error throws in
ErrorBoundary, NaN/MAX_SAFE_INTEGER in formatCents, invalid dates,
carriage returns in CSV, self-closing HTML tags in sanitize, non-digit
input in DateInput, panel-click-not-dismissing in ConfirmDialog,
role="search" on FilterBar.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-10 23:14:59 +02:00
parent 591842c5a1
commit c794e82464
9 changed files with 223 additions and 0 deletions
@@ -183,6 +183,22 @@ describe("ErrorBoundary", () => {
});
});
describe("edge cases", () => {
it("catches a thrown string (non-Error object)", () => {
function ThrowString(): React.ReactNode {
throw "string error";
}
const spy = vi.spyOn(console, "error").mockImplementation(() => {});
render(
<ErrorBoundary>
<ThrowString />
</ErrorBoundary>,
);
expect(screen.getByText(/something went wrong/i)).toBeInTheDocument();
spy.mockRestore();
});
});
describe("DefaultErrorFallback", () => {
it("renders the heading", () => {
render(<DefaultErrorFallback error={new Error("Boom")} reset={vi.fn()} />);