Skip to content

fix: repair failing tests and type errors across the monorepo - #156

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier3-2163-1788884466
Open

fix: repair failing tests and type errors across the monorepo#156
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier3-2163-1788884466

Conversation

@stooit

@stooit stooit commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all failing tests and eliminates all type errors in the monorepo. bun test now reports 13 pass / 0 fail and tsc --noEmit exits clean. No test files were modified and no dependencies were added.

Bugs fixed

Package File Fix
root bunfig.toml environment = "happy-dom" is not a valid Bun key (silently ignored → document is not defined in React component tests). Switched to preload of the happy-dom setup so the DOM is registered.
utils packages/utils/src/format/date.ts formatDate zero-padded single-digit days (01/03/2024). Test expects day-first 1/03/2024. en-AU resolves day: 'numeric' to 2-digit; en-GB honours it — now emits unpadded day, 2-digit month, 4-digit year.
web apps/web/src/lib/api.ts useThrottle was renamed to useDebounce in @e2e/utils. Updated the import, usage and the useSearchDebounce re-export.
ui packages/ui/src/components/Button/Button.tsx Icon-only buttons had no aria-label. Now passes an explicit label through, falling back to a meaningful name derived from string children before a last-resort literal.
ui packages/ui/src/components/DataTable/DataTable.tsx Sort-direction toggle read sortDir from the render closure. Switched to the functional setSortDir(prev => ...) form.
root tsconfig.json Added "types": ["bun-types"] so bun:test imports resolve under tsc.

Verification

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

Assumptions & notes

  • aria-label for icon-only buttons: the test only asserts a non-null label. The sound long-term fix is a discriminated union making aria-label mandatory when iconOnly is true, but that would require changing the test, so it's out of scope here. This PR derives a meaningful name from children where possible and keeps a "button" literal only as a last resort. Worth a follow-up ticket.
  • en-GB locale in formatDate: produces byte-identical output to an en-AU + zero-strip approach on tested dates while keeping the 4-digit year. Flagged as a latent trap if weekday/month: 'long' are later added. formatDateTime untouched.
  • bun-types at root scope: minimal change that makes bun:test resolve; scoping it to test files via a dedicated tsconfig is a reasonable follow-up.
  • DataTable functional setState: correct best-practice for a toggle derived from prior state; docblock updated to remove an inaccurate failure-mode description.

🤖 Generated autonomously.

…hook rename

- bunfig.toml: use preload for happy-dom setup so React component tests
  have a DOM (bare `bun test` previously threw 'document is not defined')
- packages/utils/src/format/date.ts: emit day-first D/MM/YYYY with a
  4-digit year (en-GB honours day: 'numeric'; en-AU zero-padded the day)
- apps/web/src/lib/api.ts: useThrottle was renamed to useDebounce in
  @e2e/utils; update import, usage and re-export
- packages/ui/.../Button.tsx: pass aria-label through for icon-only
  buttons, deriving a meaningful name from children when available
- packages/ui/.../DataTable.tsx: use functional setState for the
  sort-direction toggle
- 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