Skip to content

fix: repair cross-package bugs so monorepo tests and tsc pass#36

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier3-2623-1781284166
Open

fix: repair cross-package bugs so monorepo tests and tsc pass#36
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier3-2623-1781284166

Conversation

@stooit

@stooit stooit commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all failing tests and type errors across the monorepo so that bun test && tsc --noEmit is clean from the repo root. 13/13 tests pass, tsc clean.

Bugs fixed

  • Renamed hook (apps/web/src/lib/api.ts) — the file imported a dead useThrottle export and re-exported it as useSearchDebounce. Now imports the current useDebounce from @e2e/utils, fixing api.test.ts (export 'useSearchDebounce' not found).
  • Missing accessibility attribute (packages/ui/Button.tsx)aria-label is now forwarded to the <button> so icon-only buttons have an accessible name.
  • Stale-closure bug (packages/ui/DataTable.tsx) — the sort handler captured stale state; fixed with functional state updaters so the controlled re-render test passes.
  • Wrong date locale/format (packages/utils/format/date.ts) — now uses day-first (en-AU, dateStyle: short) formatting, e.g. 1/03/2024, matching date.test.ts.

Test-infra fixes (config, not test files)

  • bunfig.toml — added a preload of the happy-dom global registrator so running bun test from the repo root has DOM globals (document, etc.). Previously only packages/ui/bunfig.toml preloaded it, so root-level runs failed with document is not defined. No new dependency — the registrator was already installed and used by the package-level preload.
  • tsconfig.json — registered bun-types so tsc --noEmit resolves Bun / bun:test globals. Strictness was not loosened.

Assumptions

  • The public hook the app should consume is useDebounce (the surviving export in packages/utils); the app's local re-export alias useSearchDebounce is preserved.
  • The expected date format is Australian day-first (en-AU), inferred from the 1/03/2024 expectation in the test.

Verification

  • bun test from repo root → 13 pass / 0 fail across 5 files.
  • tsc --noEmit → clean (exit 0).

Constraints honoured

No test files modified, no new dependencies added. Changes reviewed (verdict: approve).

- api.ts: import renamed useDebounce (was dead useThrottle export)
- Button: forward aria-label to button element for accessible name
- DataTable: fix stale-closure in handleSort via functional state updaters
- date.ts: use en-AU dateStyle:short for day-first date formatting
- bunfig.toml: preload happy-dom registrator so root bun test has DOM globals
- tsconfig.json: register bun-types so tsc resolves Bun/bun:test globals
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