Skip to content

fix: repair cross-package test failures in monorepo - #128

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier3-2446-1787069447
Open

fix: repair cross-package test failures in monorepo#128
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier3-2446-1787069447

Conversation

@stooit

@stooit stooit commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all 5 failing tests and eliminates all type errors across the monorepo. bun run test13 pass / 0 fail; bun x tsc --noEmitexit 0. No test files modified, no dependencies added.

Changes

  • apps/web/src/lib/api.ts — The importer referenced a non-existent useThrottle. Reconciled to import the actual useDebounce export from @e2e/utils and re-export it as useSearchDebounce, satisfying the api test and clearing TS2305.
  • packages/ui/.../Button.tsxaria-label was destructured but never applied to the DOM. Now forwarded; for iconOnly buttons without an explicit label it derives one from string children (falling back to "Button" with a dev-only warning), meeting WCAG 2.2 SC 4.1.2. Non-icon buttons keep their visible text as the accessible name.
  • packages/ui/.../DataTable.tsx — Stale-closure sort bug: setSortDir read sortDir from the render-time closure, so descending never triggered on the second click. Replaced with a functional updater setSortDir(prev => prev === "asc" ? "desc" : "asc").
  • packages/utils/.../date.tsen-AU already produces correct day-first ordering; the only defect was ICU zero-padding the day (01/03/2024). Used formatToParts to strip padding from the day part only, so 1 March 2024 → 1/03/2024. formatDateTime and formatAUD untouched and still passing.
  • tsconfig.json — Added "types": ["bun-types"] to resolve four pre-existing TS2307: Cannot find module 'bun:test' errors. bun-types was already a devDependency; moduleResolution: bundler with no types array meant it wasn't loaded. Verified no @types/* regressions (react/JSX/DOM/NodeJS.Timeout all still resolve).

Verification

bun run test  ->  13 pass, 0 fail, 17 expect() calls
bun x tsc --noEmit  ->  exit 0

Reviewed by the review agent: verdict COMMENT, no blocking issues; all four functional fixes verified correct and the tsconfig change confirmed necessary with no side effects.

Assumptions

  • The task brief hinted a hook was "renamed to useThrottle"; the actual repo state was the reverse — useDebounce is the real export and api.ts was the stale importer. Fixed the importer (minimal change) rather than renaming the shared hook, since the api test imports from ../src/lib/api and expects useSearchDebounce there.
  • The unlabelled icon-only Button test asserts aria-label must be non-null, so a derived/fallback label is required by the test; kept the dev warning to surface the underlying a11y concern to callers.

- web: fix stale importer to use useDebounce (re-exported as
  useSearchDebounce) instead of the non-existent useThrottle
- ui/Button: forward aria-label and derive an accessible name for
  icon-only buttons (WCAG 2.2 SC 4.1.2)
- ui/DataTable: fix stale-closure sort by using a functional state
  updater so descending sort works on the second click
- utils/date: strip zero-padding from the day in en-AU formatDate
- tsconfig: add bun-types to types array to resolve bun:test imports
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