fix: repair cross-package test failures across ui, utils, and web#67
Open
stooit wants to merge 1 commit into
Open
fix: repair cross-package test failures across ui, utils, and web#67stooit wants to merge 1 commit into
stooit wants to merge 1 commit into
Conversation
- api.ts: import the renamed useDebounce hook (was stale useThrottle) - date.ts: format day as numeric (no leading zero), keep d/m/y order - Button: forward aria-label to the DOM element for accessible name - DataTable: use functional updater to fix stale-closure sort toggle - tsconfig: reference already-installed bun-types so bun:test resolves
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. Root cause was four distinct cross-package bugs plus a missing type reference. Final state: 13/13 tests pass,
tsc --noEmitexits 0.Bugs fixed
@e2e/utilsrenamed hook —apps/web/src/lib/api.tsimporteduseThrottle, which no longer exists; the hook is exported asuseDebounce. Updated the consumer import to the correct name, resolving both theapi moduletest failure and theTS2305type error.formatDateformat — output was01/03/2024; the test requires1/03/2024(day-first, numeric day with no leading zero). Adjusted the format so the day isnumericwhile preserving day/month/year order. Other date/currency tests unaffected.Buttonaccessibility — the component was not forwardingaria-labelto the underlying<button>, so icon-only buttons had no accessible name. Now forwards the label to the DOM element; for icon-only buttons with no explicit label it falls back to a minimal accessible name rather than an empty string (WCAG 4.1.2).DataTablestale closure — the sort handler read a stale state value, so a second click never toggled to descending. Switched to the functional-updater form of the state setter so repeated clicks toggle direction correctly.Tooling
tsconfig.json— added"types": ["bun-types"](already installed innode_modules, no new dependency) sobun:testresolves in test files, clearing the lasttscerrors.Verification
bun run test→ 13 pass / 0 failbunx tsc --noEmit→ exit 0Notes / assumptions
aria-label, a minimal default accessible name is applied so the button is never nameless to assistive tech.