Skip to content

fix: repair cross-package bugs and test DOM/type configuration#75

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier3-2430-1784046930
Open

fix: repair cross-package bugs and test DOM/type configuration#75
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier3-2430-1784046930

Conversation

@stooit

@stooit stooit commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all failing tests and type errors in the monorepo. bun test && bunx tsc --noEmit now passes cleanly from the repo root (13 pass, 0 fail; tsc exit 0).

Bug fixes (source root-causes)

  1. Renamed hook / stale importapps/web/src/lib/api.ts imported useThrottle, but the hook in packages/utils was renamed to useDebounce. Updated the import and re-exported it as useSearchDebounce (the name the test expects).
  2. Button accessibility — icon-only Button now sets an aria-label so it has an accessible name.
  3. DataTable stale closure — sort-direction toggle used a value captured in a stale closure, so "sort descending on second click" failed. Switched to a functional state updater to read the latest direction.
  4. Date formatting localepackages/utils/src/format/date.ts used a locale/format that swapped day and month. Now uses a locale-correct dateStyle: 'short' so day 1 is not confused with month 1.

Test/type infrastructure

  • Root bunfig.toml — added the happy-dom setup preload so React component tests get a DOM when bun test runs from the repo root (previously only wired into packages/ui/bunfig.toml, which is not read at root level → document is not defined).
  • tsconfig.json — added bun-types so bun:test imports resolve under tsc --noEmit.

Verification

  • bun test → 13 pass / 0 fail
  • bunx tsc --noEmit → exit 0
  • No test files modified; no new dependencies added.

Notes / assumptions

  • All existing packages (happy-dom, @happy-dom/global-registrator, bun-types) were already installed — nothing new added.
  • Reviewed by the review subagent: APPROVE — all four fixes address genuine root causes with no masking or regressions.

- api.ts: import useDebounce (renamed from useThrottle) and re-export as useSearchDebounce
- Button: set aria-label for icon-only buttons for accessible name
- DataTable: use functional state updater to fix stale-closure sort direction
- date.ts: use en-AU dateStyle:'short' so day/month order follows locale
- bunfig.toml (root): register happy-dom + setup preload so component tests get a DOM at root-level runs
- tsconfig.json: add 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