Skip to content

fix: repair cross-package bugs so all tests and typecheck pass - #126

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier3-2929-1787019959
Open

fix: repair cross-package bugs so all tests and typecheck pass#126
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier3-2929-1787019959

Conversation

@stooit

@stooit stooit commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all failing tests and type errors in the monorepo. Before: 8 pass / 5 fail, 5 tsc errors. After: 13 pass / 0 fail, tsc --noEmit exit 0.

Four bugs spanning three packages plus a tsconfig fix:

  • apps/web/src/lib/api.ts — the useThrottle hook was renamed to useDebounce in packages/utils, but the old name was still imported here. Updated the import and the useSearchDebounce re-export. Fixes 2 test failures + TS2305.
  • packages/ui/src/components/Button/Button.tsx — icon-only buttons had no accessible name (WCAG 4.1.2). Now applies aria-label for iconOnly buttons, derived from an explicit label → string children → "Button" fallback. The fallback is whitespace-safe, keeping the dev-warning guard and the accessible-name logic consistent. Text buttons are unchanged and never receive an overriding label. Fixes 2 test failures.
  • packages/utils/src/format/date.tsformatDate was zero-padding the day (01/03/2024); the test expects en-AU style (1/03/2024). Now rebuilds via formatToParts and un-pads the day. formatDateTime is untouched. Fixes 1 test failure.
  • tsconfig.json — added "types": ["bun-types"] so bun:test resolves. Fixes 4 × TS2307.

Testing

  • bun run test → 13 pass / 0 fail
  • tsc --noEmit → exit 0

Assumptions & notes

  • No test files were modified, no dependencies added, per constraints.
  • DataTable.tsx was left unchanged. There is a latent stale-closure pattern in its sort handler, but every current DataTable test passes legitimately (fireEvent.click wraps each click in its own act(), so clicks don't coalesce into one batch). A proper fix (setSortDir(prev => ...)) would only be exercisable with a new batched-click regression test — which the "do not modify test files" constraint forbids. Consistent with "fix only what the tests require," no change was made. Recommended as a follow-up.
  • Run tests via the test npm script (bun run test), not bare bun test — the script preloads happy-dom for the DOM environment.

- api.ts: update stale useThrottle import to renamed useDebounce hook
- Button: add aria-label for icon-only buttons (WCAG 4.1.2), with
  whitespace-safe fallback that agrees with the dev-warning guard
- date: un-pad the day in formatDate for en-AU style (1/03/2024)
- tsconfig: add bun-types to compilerOptions.types for bun:test module

13/13 tests pass, tsc --noEmit clean.
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