Skip to content

fix: repair cross-package bugs to make all tests pass and clear type errors - #164

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier3-2176-1788944353
Open

fix: repair cross-package bugs to make all tests pass and clear type errors#164
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier3-2176-1788944353

Conversation

@stooit

@stooit stooit commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all failing tests (13/13 now pass) and eliminates all TypeScript errors (tsc --noEmit exit 0) across the monorepo. Four cross-package bugs plus one pre-existing tsconfig gap were addressed. No test files were modified and no dependencies were added.

Fixes

  • Renamed hook import (apps/web/src/lib/api.ts): the utils hook was renamed useThrottleuseDebounce, but apps/web still imported the old name. Updated the consumer to import useDebounce and re-export it as useSearchDebounce (the public name the test depends on).
  • Button accessibility (packages/ui/src/components/Button/Button.tsx): pass aria-label through to the rendered <button> so icon-only buttons have an accessible name (WCAG 2.2 SC 4.1.2), with a fallback + dev-only warn when missing.
  • DataTable stale closure (packages/ui/src/components/DataTable/DataTable.tsx): sort handler read sortDir from a stale closure; collapsed into one atomic sort: { key, dir } state via a pure functional updater — StrictMode-safe.
  • AU date format (packages/utils/src/format/date.ts): formatDate renders day-first without a leading zero (e.g. 1/03/2024) using Intl.formatToParts with en-AU.
  • tsconfig types (tsconfig.json): registered bun-types so bun:test resolves, clearing 4 pre-existing TS2307 errors (config registration; bun-types was already a devDependency).

Verification

  • bun run test → 13 pass / 0 fail
  • bunx tsc --noEmit → exit 0
  • No test files modified; independent review confirmed correctness and no regressions.

Notes

  • Ran tests via the project's bun run test script (applies the happy-dom setup preload; a bare bun test misses it and surfaces spurious document is not defined errors).
  • Some tests encode specific contracts (e.g. day-first /^1/ date format); implementations follow the tests as written since test files were off-limits.

Follow-ups (out of scope)

  • DataTable sortable <th> is mouse-only (pre-existing WCAG 2.1.1 gap).
  • Consider a discriminated-union prop type to require aria-label when iconOnly.

…e format

- apps/web: use renamed useDebounce hook (was useThrottle) re-exported as useSearchDebounce
- packages/ui Button: pass aria-label through for accessible name (WCAG 4.1.2)
- packages/ui DataTable: fix stale-closure in sort toggle via single atomic state
- packages/utils formatDate: day-first AU format without leading zero via formatToParts
- tsconfig: register bun-types so bun:test resolves
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