fix: repair cross-package bugs failing tests and typecheck - #162
Open
stooit wants to merge 1 commit into
Open
Conversation
- api.ts: import renamed useDebounce (was stale useThrottle) from @e2e/utils, preserve public useSearchDebounce re-export - Button: apply aria-label to icon-only buttons with runtime fallback + dev warning (WCAG 2.2 SC 4.1.2) - formatDate: build AU D/MM/YYYY manually so day is not zero-padded - tsconfig: wire bun-types so bun:test resolves (tsc --noEmit now exits 0)
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
Repairs four cross-package bugs so
bun run testandtsc --noEmitare both green. No test files modified, no dependencies added.Before: 8 pass / 5 fail,
tsc --noEmitexits 2 (5 errors).After: 13 pass / 0 fail,
tsc --noEmitexits 0.Fixes
apps/web/src/lib/api.ts— The utils hook was renameduseThrottle→useDebounce, butapi.tsstill imported and re-exported the old name. Updated the import and re-export touseDebounce, preserving the app-facing public nameuseSearchDebounce(a test asserts it is exported). Removed the now-false// BUG:comments. Fixes bothapi.test.tsfailures and theTS2305error.packages/ui/src/components/Button/Button.tsx— Icon-only buttons emitted no accessible name (WCAG 2.2 SC 4.1.2). Thearia-labelprop is kept optional (a read-only test rendersiconOnlywith no label and expects the attribute present, so requiring it would break that test at type-check time). Added a runtime fallback accessible name plus a dev-onlyconsole.warnnudging callers toward a real label.packages/utils/src/format/date.ts—formatDatezero-padded the day (01/03/2024); the test requires day-first without a leading zero. Replaced theIntl.DateTimeFormatbody with a manualD/MM/YYYYbuild (1/03/2024,15/06/2024), preserving the documented 4-digit-year contract.formatDateTimeleft untouched.tsconfig.json— Added"types": ["bun-types"]sobun:testresolves in test files. Verified React/JSX type-checking is unchanged.Assumptions / notes
handleSortrecreated each render; the two clicks are separate React batches). No change made per "fix only what tests require".formatDateformat choice: chose a manual build overdateStyle: "short"because the latter silently downgrades the year to 2 digits (24), regressing the documentedDD/MM/YYYYcontract."Button"fallback label satisfiesnot.toBeNull()but is generic; theconsole.warnis the real enforcement pushing callers to supply a meaningful label.Follow-ups (out of scope — would touch tests)
formatDatevsformatDateTimedisagree on month padding and year width (2024vs24); worth aligning.Test plan
bun run test→ 13 pass, 0 fail./node_modules/.bin/tsc --noEmit→ exit 0, no errors