fix: resolve failing tests across ui, utils, and web packages - #117
Open
stooit wants to merge 1 commit into
Open
fix: resolve failing tests across ui, utils, and web packages#117stooit wants to merge 1 commit into
stooit wants to merge 1 commit into
Conversation
- api.ts: import renamed useDebounce hook and re-export as useSearchDebounce - Button: apply aria-label to icon-only buttons for WCAG 4.1.2, warn on missing label - DataTable: use functional setState updater in handleSort to avoid stale closure - date: format day without leading zero via en-GB locale - tsconfig: add bun-types and include apps test dirs for typechecking
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.
bun run testnow reports 13 pass / 0 fail andtsc --noEmitreports 0 errors. No test files were modified and no dependencies were added.Changes
apps/web/src/lib/api.tsuseThrottlehook was renamed touseDebouncein@e2e/utils, butapi.tsstill imported the old name. Updated the import and theuseSearchDebouncere-export. Fixes bothapi.test.tsfailures and theTS2305error.packages/ui/src/components/Button/Button.tsxariaLabelprop was destructured but never applied. Now applied viaaria-label, with a fallback for icon-only buttons and a dev-onlyconsole.warnwhen a label is missing (WCAG 2.2 SC 4.1.2).packages/utils/src/format/date.tsformatDatezero-padded the day (01/03/2024); the test expects1/03/2024. Switched fromen-AUtoen-GBwith{day:"numeric", month:"2-digit", year:"numeric"}— same D/M/Y order, no day padding.formatDateTimeleft unchanged.packages/ui/src/components/DataTable/DataTable.tsxhandleSort: replacedsetSortDir(sortDir === ...)with the functional updatersetSortDir(prev => ...).tsconfig.json"types": ["bun-types"]to resolveCannot find module 'bun:test', and addedapps/*/test/**/*toinclude(previously omitted, which is why the brokenapi.tsimport wasn't caught by tsc).Verification
bun run test→ 13 pass / 0 failnpx tsc --noEmit→ 0 errorsAssumptions / notes
aria-labelfallback: the"Button"fallback for an icon-only button with no label satisfies the test's non-null assertion but is a non-descriptive accessible name. Theconsole.warnis intended to push callers toward a meaningful label. Enforcing a required label at the type level would be a breaking API change and is out of scope.[Button] iconOnly requires an aria-labelline in test output is the expected dev warning from the intentional no-label test path, not a failure.