fix: repair cross-package bugs so all tests and typecheck pass - #126
Open
stooit wants to merge 1 commit into
Open
fix: repair cross-package bugs so all tests and typecheck pass#126stooit wants to merge 1 commit into
stooit wants to merge 1 commit into
Conversation
- api.ts: update stale useThrottle import to renamed useDebounce hook - Button: add aria-label for icon-only buttons (WCAG 4.1.2), with whitespace-safe fallback that agrees with the dev-warning guard - date: un-pad the day in formatDate for en-AU style (1/03/2024) - tsconfig: add bun-types to compilerOptions.types for bun:test module 13/13 tests pass, tsc --noEmit clean.
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 failing tests and type errors in the monorepo. Before: 8 pass / 5 fail, 5 tsc errors. After: 13 pass / 0 fail,
tsc --noEmitexit 0.Four bugs spanning three packages plus a tsconfig fix:
apps/web/src/lib/api.ts— theuseThrottlehook was renamed touseDebounceinpackages/utils, but the old name was still imported here. Updated the import and theuseSearchDebouncere-export. Fixes 2 test failures +TS2305.packages/ui/src/components/Button/Button.tsx— icon-only buttons had no accessible name (WCAG 4.1.2). Now appliesaria-labelforiconOnlybuttons, derived from an explicit label → string children →"Button"fallback. The fallback is whitespace-safe, keeping the dev-warning guard and the accessible-name logic consistent. Text buttons are unchanged and never receive an overriding label. Fixes 2 test failures.packages/utils/src/format/date.ts—formatDatewas zero-padding the day (01/03/2024); the test expects en-AU style (1/03/2024). Now rebuilds viaformatToPartsand un-pads the day.formatDateTimeis untouched. Fixes 1 test failure.tsconfig.json— added"types": ["bun-types"]sobun:testresolves. Fixes 4 ×TS2307.Testing
bun run test→ 13 pass / 0 failtsc --noEmit→ exit 0Assumptions & notes
DataTable.tsxwas left unchanged. There is a latent stale-closure pattern in its sort handler, but every current DataTable test passes legitimately (fireEvent.clickwraps each click in its ownact(), so clicks don't coalesce into one batch). A proper fix (setSortDir(prev => ...)) would only be exercisable with a new batched-click regression test — which the "do not modify test files" constraint forbids. Consistent with "fix only what the tests require," no change was made. Recommended as a follow-up.testnpm script (bun run test), not barebun test— the script preloads happy-dom for the DOM environment.