Skip to content

fix: repair cross-package bugs and test config in monorepo#57

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier3-3663-1782492530
Open

fix: repair cross-package bugs and test config in monorepo#57
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier3-3663-1782492530

Conversation

@stooit

@stooit stooit commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all failing tests and type errors across the bun-workspaces monorepo. bun test is now 13 pass / 0 fail and npx tsc --noEmit exits 0. Changes are minimal and targeted; no test files were modified and no dependencies were added.

Bugs fixed

  • apps/web/src/lib/api.ts — imported a renamed hook under its old name. useThrottleuseDebounce (only useDebounce is exported from @e2e/utils). (fixes TS2305)
  • packages/ui/.../Button/Button.tsx — icon-only button had no accessible name. Forwards aria-label to the <button>, satisfying getByRole('button', { name: ... }). (WCAG 4.1.2 Name, Role, Value)
  • packages/ui/.../DataTable/DataTable.tsx — stale-closure bug: handleSort read sortDir from the captured closure, so re-clicking a column toggled against a stale value. Switched to the functional updater setSortDir(prev => ...).
  • packages/utils/src/format/date.ts — explicit numeric field options forced M/D/Y ordering regardless of locale. Switched to { dateStyle: 'short' } so en-AU correctly produces day-first ordering.

Test/build config (config-only, no test files touched)

  • bunfig.toml (root) — added preload = ["./packages/ui/test/setup.ts"] so the happy-dom GlobalRegistrator registers DOM globals when bun test runs from the repo root. Fixes ReferenceError: document is not defined.
  • tsconfig.json — added "types": ["bun-types"] so bun:test imports resolve under tsc. (fixes TS2307)

Verification

  • bun test → 13 pass, 0 fail
  • npx tsc --noEmit → exit 0
  • Independent review pass confirmed each change is a genuine fix (not a test-silencing hack) with no unintended behavioural changes.

Assumptions

  • The intended hook name is useDebounce (the only export from @e2e/utils); the old useThrottle import was the bug.
  • dateStyle: 'short' is the intended formatting approach for en-AU day-first output.

- api.ts: import useDebounce (hook was renamed from useThrottle)
- Button: forward aria-label for accessible name on icon-only buttons
- DataTable: use functional setState to fix stale-closure sort toggle
- date.ts: use dateStyle:'short' so en-AU yields day-first ordering
- bunfig.toml: preload happy-dom GlobalRegistrator so DOM globals exist
- 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