From 07715bbc9f6987a94b336b44a73dc1bc89c52305 Mon Sep 17 00:00:00 2001 From: QuantCode Agent Date: Sat, 1 Aug 2026 23:06:47 +0000 Subject: [PATCH] fix: resolve failing tests and type errors across monorepo - api.ts: correct renamed hook import (useThrottle -> useDebounce) - Button: apply aria-label for iconOnly buttons + dev-only warning (WCAG 4.1.2) - DataTable: fix stale-closure in sort toggle via functional setState - date.ts: formatDate emits day-first D/MM/YYYY without day zero-padding - tsconfig: load bun-types so bun:test resolves under tsc All 13 tests pass; tsc --noEmit is clean. --- apps/web/src/lib/api.ts | 12 +- ...08-01-fix-5-failing-tests-and-tsc-error.md | 243 ++++++++++++++++++ packages/ui/src/components/Button/Button.tsx | 24 +- .../ui/src/components/DataTable/DataTable.tsx | 15 +- packages/utils/src/format/date.ts | 26 +- tsconfig.json | 1 + 6 files changed, 282 insertions(+), 39 deletions(-) create mode 100644 docs/plans/2026-08-01-fix-5-failing-tests-and-tsc-error.md diff --git a/apps/web/src/lib/api.ts b/apps/web/src/lib/api.ts index 2d4731b..c917f89 100644 --- a/apps/web/src/lib/api.ts +++ b/apps/web/src/lib/api.ts @@ -1,14 +1,8 @@ /** * API client utilities for the web app. - * - * BUG: imports `useThrottle` from @e2e/utils, but that hook was renamed to - * `useDebounce`. This causes a TypeScript error and a runtime crash. - * - * Fix: change the import to `useDebounce`. */ -// BUG: useThrottle no longer exists — was renamed to useDebounce -import { useThrottle } from "@e2e/utils" +import { useDebounce } from "@e2e/utils" import { formatDate, formatAUD } from "@e2e/utils" export const BASE_URL = process.env.API_URL ?? "http://localhost:3000" @@ -28,5 +22,5 @@ export async function fetchPosts() { // Re-export formatting utilities used throughout the app export { formatDate, formatAUD } -// Re-export the debounce hook (currently broken import) -export { useThrottle as useSearchDebounce } +// Re-export the debounce hook under the app-local name +export { useDebounce as useSearchDebounce } diff --git a/docs/plans/2026-08-01-fix-5-failing-tests-and-tsc-error.md b/docs/plans/2026-08-01-fix-5-failing-tests-and-tsc-error.md new file mode 100644 index 0000000..22c46d5 --- /dev/null +++ b/docs/plans/2026-08-01-fix-5-failing-tests-and-tsc-error.md @@ -0,0 +1,243 @@ +# Fix plan — 5 failing tests + 1 tsc error + +**Date:** 2026-08-01 +**Branch:** `quantcode/e2e-tier3-2301-1785624453` +**Verify with:** `bun run test` and `bun run typecheck` +**Constraint:** source files only — do NOT edit any file under a `test/` directory. + +## Status: all fixes pre-verified + +Applied to a scratch copy of the repo, then reverted. Result: **13 pass / 0 fail** (was 8 pass / 5 fail), +and `tsc --noEmit --types bun-types,react` clean. The four edits below are exactly what was validated. + +Baseline failures confirmed: + +| # | Test | Cause | +|---|------|-------| +| 1 | `api.test.ts` — both tests | `SyntaxError: export 'useSearchDebounce' not found in '@e2e/utils'` + `TS2305` | +| 2 | `Button.test.tsx` — 2 aria-label tests | `aria-label` never applied to `