Skip to content

fix: resolve 4 cross-package bugs causing 9 test failures#13

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/job-e2e-tier3-2337-1779640228
Open

fix: resolve 4 cross-package bugs causing 9 test failures#13
stooit wants to merge 1 commit into
mainfrom
quantcode/job-e2e-tier3-2337-1779640228

Conversation

@stooit
Copy link
Copy Markdown
Contributor

@stooit stooit commented May 24, 2026

Summary

Fixes all 9 failing tests across this TypeScript monorepo by resolving 4 cross-package bugs:

  • Renamed hook import (packages/utilsapps/web): useThrottle was renamed to useDebounce in utils but the old name was still imported in apps/web/src/lib/api.ts. Fixed the import and added a useSearchDebounce re-export to match what consumers expect.
  • Missing accessibility attribute (packages/ui): The icon-only Button variant was missing an aria-label prop, causing an a11y test to fail.
  • Stale closure bug (packages/ui): The DataTable sort handler captured a stale sortDirection value. Fixed by using a functional state update (prev => ...).
  • Wrong date format (packages/utils): formatDate used dd/MM/yyyy (zero-padded day) but tests expect d/MM/yyyy (no leading zero on day).
  • DOM environment for tests: Configured bun test to preload happy-dom so React component tests have a DOM available.

Verification

bun test → 13 pass, 0 fail
npx tsc --noEmit → only expected bun:test module resolution errors in test files

Assumptions

  • The bun:test TypeScript module resolution errors are expected (bun provides this at runtime) and not considered failures.
  • happy-dom was already installed in node_modules — no new dependencies added.

- Fix renamed hook import: useThrottle → useDebounce in apps/web/src/lib/api.ts,
  re-exported as useSearchDebounce to match consumer expectations
- Add aria-label to icon-only Button variant for accessibility
- Fix stale closure in DataTable sort handler using functional state update
- Fix date format string to use d/MM/yyyy (no zero-padded day)
- Configure bun test DOM environment via happy-dom preload script
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