Skip to content

fix: repair cross-package test and type failures - #86

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier3-2547-1784911170
Open

fix: repair cross-package test and type failures#86
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier3-2547-1784911170

Conversation

@stooit

@stooit stooit commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all failing tests and type errors across the monorepo (packages/ui, packages/utils, apps/web). After changes: 13/13 tests pass, tsc --noEmit clean. No test files or dependencies were modified.

Changes

Area Fix
Test DOM envbunfig.toml React tests threw document is not defined. Added preload = ["./packages/ui/test/setup.ts"] so happy-dom's GlobalRegistrator.register() runs before @testing-library/react's render().
Type resolutiontsconfig.json Cannot find module 'bun:test'. Added "types": ["bun-types"] to compilerOptions.
Stale importapps/web/src/lib/api.ts useThrottle was renamed to useDebounce in @e2e/utils; updated the import and the as useSearchDebounce re-export.
AccessibilityButton.tsx The aria-label prop was destructured but never applied. Now forwarded to the <button> (omitted by React when undefined, so other buttons are unaffected).
Stale closureDataTable.tsx Sort direction toggle read stale sortDir from the closure. Switched to the functional updater form setSortDir(prev => ...).
Date localepackages/utils/src/format/date.ts Explicit numeric options produced month-first, zero-padded output. Switched to en-AU with { dateStyle: "short" } for day-first, non-zero-padded days.

Assumptions

  • Config files (bunfig.toml, tsconfig.json) are in scope; only test files were treated as off-limits.
  • The existing packages/ui/test/setup.ts already registers happy-dom, so only the preload wiring was needed.
  • en-AU is the intended locale (matches the pre-existing locale string; only the format options were wrong).

Verification

$ bun test
 13 pass / 0 fail  (5 files)
$ npx tsc --noEmit
(exit 0)

- wire happy-dom preload in bunfig.toml so React tests get a DOM
- add bun-types to tsconfig so tsc resolves bun:test
- fix stale useThrottle->useDebounce import in apps/web api
- forward aria-label on Button for accessible name
- use functional updater in DataTable sort to fix stale closure
- use en-AU dateStyle:short so formatDate is day-first, no zero-pad
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