Skip to content

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

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/job-e2e-tier3-2398-1779553756
Open

fix: resolve 4 cross-package bugs causing test failures#12
stooit wants to merge 1 commit into
mainfrom
quantcode/job-e2e-tier3-2398-1779553756

Conversation

@stooit
Copy link
Copy Markdown
Contributor

@stooit stooit commented May 23, 2026

Summary

Fixes all failing tests across the monorepo (13 tests now pass, 0 fail) and eliminates TypeScript errors.

Bugs Fixed

  • Renamed hook (packages/utilsapps/web): The useDebounce hook was exported from utils but apps/web imported the old name useSearchDebounce. Added a useSearchDebounce re-export alias. Also removed the stale useThrottle import that caused a TS2305 error.

  • Button accessibility (packages/ui): The Button component wasn't spreading remaining props onto the DOM element, so aria-label (and other HTML attributes) were silently dropped. Fixed by spreading ...rest props.

  • DataTable stale closure (packages/ui): The sort click handler captured stale sortDirection state via closure. Fixed by using a functional state update (prev => ...) pattern.

  • Date format (packages/utils): formatDate used dd/MM/yyyy (zero-padded day) but tests expected d/MM/yyyy (no padding). Fixed the format string.

  • Test environment config: Root bunfig.toml needed a preload pointing to the happy-dom setup file so that UI tests get a DOM when bun test is run from the repo root.

Assumptions

  • The bun:test TypeScript module resolution warnings are expected (no @types/bun installed) and not real errors.
  • useSearchDebounce is kept as an alias for useDebounce to maintain backward compatibility with apps/web.

- Fix renamed hook: export useSearchDebounce from @e2e/utils and fix
  stale useThrottle import in apps/web/src/lib/api.ts
- Fix Button component: spread remaining props (including aria-label)
  onto the rendered button element
- Fix DataTable stale closure: use functional state update in sort
  handler to avoid capturing stale state
- Fix date format: use 'd/MM/yyyy' pattern (no zero-padding on day)
- Fix test environment: configure happy-dom preload in root bunfig.toml
  so UI tests have DOM access when run from repo root
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