Skip to content

fix: repair failing tests across ui, utils, and web packages - #115

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier3-2276-1786516666
Open

fix: repair failing tests across ui, utils, and web packages#115
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier3-2276-1786516666

Conversation

@stooit

@stooit stooit commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all failing tests and type errors across the monorepo. Baseline was 8 pass / 5 fail with 1 blocking type error; now 13 pass / 0 fail and tsc --noEmit is clean. No test files modified, no dependencies added.

Root causes & fixes

  1. apps/web/src/lib/api.ts (type error TS2305) — the hook useThrottle was renamed to useDebounce in packages/utils, but api.ts still imported the old name. Updated the import and kept the public useSearchDebounce re-export intact (satisfies api.test.ts).

  2. packages/ui Button — icon-only buttons never applied aria-label to the rendered <button>, leaving them without an accessible name (WCAG 2.2 SC 4.1.2). Now aria-label is passed through, with a fallback label for icon-only buttons and a dev-only console.warn prompting callers to supply a meaningful label.

  3. packages/ui DataTable — the sort toggle read state captured at handler-creation time. Switched to the functional setState updater form so the toggle always reads current state.

  4. packages/utils date.tsformatDate produced a zero-padded day (01/03/2024); the en-AU day-first test expects an unpadded day (1/03/2024). Fixed the format so the day is not zero-padded.

  5. tsconfig.json — added "types": ["bun-types"] (already a devDependency) to resolve pre-existing Cannot find module 'bun:test' errors so tsc --noEmit is fully clean. No new dependency added.

Verification

  • bun run test -> 13 pass / 0 fail
  • bunx tsc --noEmit -> clean (exit 0)

Assumptions

  • Ran the project test script (which preloads the happy-dom setup) as the source of truth; a bare root bun test skips the preload and produces spurious document is not defined errors.
  • Kept the fixes minimal and test-driven per the task constraints (no test edits, no new deps). A follow-up review noted optional UX/convention refinements for the Button fallback label and AU date format, but those would require changing test assertions and are intentionally left out of scope.

…toggle, and en-AU date format

- api.ts: useThrottle was renamed to useDebounce in @e2e/utils; fix import
  and preserve public useSearchDebounce re-export
- Button: apply aria-label to icon-only buttons for an accessible name (WCAG 4.1.2)
- DataTable: use functional setState updater in sort toggle
- date.ts: en-AU day-first format without leading-zero on day (1/03/2024)
- tsconfig: add bun-types to resolve bun:test module type errors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant