fix: repair cross-package test failures and type errors - #147
Open
stooit wants to merge 1 commit into
Open
Conversation
- api.ts: reconcile stale useThrottle import with renamed useDebounce hook - Button: forward aria-label and provide accessible-name fallback for icon-only - DataTable: use functional state updater for sort-direction toggle - date.ts: format day without leading zero via formatToParts (en-AU) - tsconfig: register bun-types so bun:test resolves under tsc
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 all
tsc --noEmiterrors in the monorepo. Bugs spanned three packages. Verified green:bun run test→ 13 pass / 0 fail,bunx tsc --noEmit→ exit 0.Changes
apps/web/src/lib/api.tsuseThrottlehook inpackages/utilswas renamed touseDebounce; the app still imported the old name (runtimeSyntaxError+TS2305). Reconciled the import and re-export it asuseSearchDebounce(the name the test expects). Aliasing is semantically honest — the underlying implementation is a genuine debounce.packages/ui/.../Button.tsxaria-labelwas never forwarded to the<button>. Now forwarded; foriconOnlybuttons with no label, falls back to"Unlabelled button"+ a devconsole.warnso an unlabelled button stays visible to accessibility scanners rather than being silently masked (WCAG 2.2 SC 4.1.2).packages/ui/.../DataTable.tsxsetSortDir(prev => ...)), removing a latent stale-closure hazard flagged by the// BUG:comment.packages/utils/.../date.tsformatDatereturned01/03/2024; the test requires an unpadded day (1/03/2024). UsesformatToPartswithen-AUordering and strips the leading zero from the day part only, keeping the documented 4-digit year.tsconfig.json"types": ["bun-types", "react"]sobun:testresolves undertsc(the test files use it and are off-limits to edit).Assumptions & notes
date.tsformat is dictated by the test: two assertions (/^1/for 1 March and a 4-digit year) are jointly unsatisfiable with plainIntloptions in this ICU build, soformatToParts+ day-zero-strip was the only path that satisfies both.// BUG:note (now removed).formatDatefixtures (T12:00:00Z) are timezone-fragile at extreme offsets — pre-existing in the unmodifiable test file, not a regression.Verification