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:
@@ -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()} />);
|
||||
|
||||
Reference in New Issue
Block a user