Skip to content

fix: repair cross-package bugs (hook import, icon-only a11y, AU date format) - #178

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier3-2203-1789662021
Open

stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier3-2203-1789662021

Conversation

@stooit

@stooit stooit commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all failing tests and the target type error in the monorepo. 13/13 tests pass and the useThrottle tsc error is eliminated. Three cross-package bugs fixed with minimal, targeted changes — no test files modified, no dependencies added.

Root causes & fixes

  1. Renamed hook import (apps/web/src/lib/api.ts)
    packages/utils renamed its hook to useDebounce, but api.ts still imported the old useThrottle (tsc TS2305). Updated the import to useDebounce and re-exported it under the app-facing name useSearchDebounce that apps/web/test/api.test.ts expects.

  2. Icon-only button accessibility (packages/ui/src/components/Button/Button.tsx) — WCAG 4.1.2
    The aria-label prop was destructured but never applied to the rendered <button>, so icon-only buttons had no accessible name. It's now forwarded; icon-only buttons with no explicit label fall back to their string children (or a placeholder) and emit a dev-mode console.warn so a missing label surfaces in CI rather than shipping silently. Non-icon-only buttons are unaffected.

  3. Date format (packages/utils/src/format/date.ts)
    formatDate for "1 March 2024" returned 01/03/2024 but the test requires day-first with an unpadded day (1/03/2024). ICU pads the day for en-AU even with day: "numeric", so the fix uses formatToParts and strips the day's leading zero while keeping locale field ordering. formatDateTime and the currency utilities are untouched.

Verification

  • bun run test -> 13 pass, 0 fail (5 files)
  • bunx tsc --noEmit -> the useThrottle error is gone. The 4 remaining Cannot find module 'bun:test' errors are pre-existing (present on the base commit), live only in test files (which must not be modified), and are unrelated to these changes.

Notes / assumptions

  • Ran via bun run test (the root package.json script), which supplies the happy-dom --preload the React DOM tests need; bare bun test from root lacks it.
  • The icon-only aria-label fallback is partly shaped by an existing test asserting the attribute is non-null even when no label is passed; a reviewer flagged this as a recorded trade-off rather than a defect. Left as-is to honour the "fix only what tests require" constraint.

🤖 Generated with QuantCode

- api.ts: import useDebounce (renamed from useThrottle), re-export as useSearchDebounce
- Button: apply aria-label for icon-only buttons (WCAG 4.1.2)
- formatDate: day-first, unpadded day for en-AU output
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