fix: repair failing tests across ui, utils, and web packages - #115
Open
stooit wants to merge 1 commit into
Open
Conversation
…toggle, and en-AU date format - api.ts: useThrottle was renamed to useDebounce in @e2e/utils; fix import and preserve public useSearchDebounce re-export - Button: apply aria-label to icon-only buttons for an accessible name (WCAG 4.1.2) - DataTable: use functional setState updater in sort toggle - date.ts: en-AU day-first format without leading-zero on day (1/03/2024) - tsconfig: add bun-types to resolve bun:test module type errors
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 across the monorepo. Baseline was 8 pass / 5 fail with 1 blocking type error; now 13 pass / 0 fail and
tsc --noEmitis clean. No test files modified, no dependencies added.Root causes & fixes
apps/web/src/lib/api.ts(type errorTS2305) — the hookuseThrottlewas renamed touseDebounceinpackages/utils, butapi.tsstill imported the old name. Updated the import and kept the publicuseSearchDebouncere-export intact (satisfiesapi.test.ts).packages/uiButton — icon-only buttons never appliedaria-labelto the rendered<button>, leaving them without an accessible name (WCAG 2.2 SC 4.1.2). Nowaria-labelis passed through, with a fallback label for icon-only buttons and a dev-onlyconsole.warnprompting callers to supply a meaningful label.packages/uiDataTable — the sort toggle read state captured at handler-creation time. Switched to the functionalsetStateupdater form so the toggle always reads current state.packages/utilsdate.ts —formatDateproduced a zero-padded day (01/03/2024); the en-AU day-first test expects an unpadded day (1/03/2024). Fixed the format so the day is not zero-padded.tsconfig.json— added"types": ["bun-types"](already a devDependency) to resolve pre-existingCannot find module 'bun:test'errors sotsc --noEmitis fully clean. No new dependency added.Verification
bun run test-> 13 pass / 0 failbunx tsc --noEmit-> clean (exit 0)Assumptions
testscript (which preloads the happy-dom setup) as the source of truth; a bare rootbun testskips the preload and produces spuriousdocument is not definederrors.