fix: repair cross-package test failures in monorepo - #128
Open
stooit wants to merge 1 commit into
Open
Conversation
- 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes all 5 failing tests and eliminates all type errors across the monorepo.
bun run test→ 13 pass / 0 fail;bun x tsc --noEmit→ exit 0. No test files modified, no dependencies added.Changes
apps/web/src/lib/api.ts— The importer referenced a non-existentuseThrottle. Reconciled to import the actualuseDebounceexport from@e2e/utilsand re-export it asuseSearchDebounce, satisfying the api test and clearing TS2305.packages/ui/.../Button.tsx—aria-labelwas destructured but never applied to the DOM. Now forwarded; foriconOnlybuttons 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:setSortDirreadsortDirfrom the render-time closure, so descending never triggered on the second click. Replaced with a functional updatersetSortDir(prev => prev === "asc" ? "desc" : "asc").packages/utils/.../date.ts—en-AUalready produces correct day-first ordering; the only defect was ICU zero-padding the day (01/03/2024). UsedformatToPartsto strip padding from the day part only, so 1 March 2024 →1/03/2024.formatDateTimeandformatAUDuntouched and still passing.tsconfig.json— Added"types": ["bun-types"]to resolve four pre-existingTS2307: Cannot find module 'bun:test'errors.bun-typeswas already a devDependency;moduleResolution: bundlerwith notypesarray meant it wasn't loaded. Verified no@types/*regressions (react/JSX/DOM/NodeJS.Timeout all still resolve).Verification
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
useThrottle"; the actual repo state was the reverse —useDebounceis the real export andapi.tswas the stale importer. Fixed the importer (minimal change) rather than renaming the shared hook, since the api test imports from../src/lib/apiand expectsuseSearchDebouncethere.aria-labelmust 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.