fix: repair cross-package bugs and DOM test wiring - #145
Open
stooit wants to merge 1 commit into
Open
Conversation
- api.ts: import renamed hook useDebounce (was useThrottle), keep useSearchDebounce alias - Button: apply aria-label with dev-only warn + fallback for icon-only buttons (SC 4.1.2) - DataTable: use functional setState to fix stale-closure sort toggle - date.ts: assemble via formatToParts so day drops its leading zero (en-AU) - bunfig.toml: preload happy-dom setup so DOM globals exist for bun test at root - tsconfig.json: include 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 9 failing tests and 5
tsc --noEmiterrors across the monorepo. 13 pass / 0 fail, typecheck clean. No test files modified, no dependencies added.Root causes & fixes
apps/web/src/lib/api.ts— importeduseThrottlefrom@e2e/utils, but the hook was renamed touseDebounce. Updated the import while preserving theas useSearchDebouncere-export the api test asserts.packages/ui/.../Button.tsx— icon-only buttons had no accessible name. Now appliesaria-label, with a dev-onlyconsole.warnand a fallback label for unlabelled icon-only buttons (WCAG 2.2 SC 4.1.2). Text buttons keep pass-through behaviour so their accessible name still derives from visible text.packages/ui/.../DataTable.tsx— sort-direction toggle read stale state from a closure. Switched to functionalsetState(prev => ...).packages/utils/src/format/date.ts—en-AUnumeric format zero-padded the day (01/03/2024), failing the/^1/assertion. Reassembled viaIntl.DateTimeFormat.formatToPartsto drop the day's leading zero (1/03/2024).bunfig.toml— addedpreload = ["./packages/ui/test/setup.ts"].bun testat the repo root resolvesbunfig.tomlfrom CWD only and never reads the per-package bunfig, so happy-dom's global-registrator wasn't running — causing thedocument is not definedfailures. This is the wiring change that fixed 6 of the 9 failures.tsconfig.json— added"types": ["bun-types"](already-installed dep) sobun:testresolves, clearing the 4TS2307errors.Verification
bun test(bare, from root): 13 pass / 0 fail, verified stable across repeated runsnpx tsc --noEmit: exit 0, cleanAssumptions & notes
fireEvent.clickflushes re-renders), but it is a genuine latent bug and the functional-setState form is strictly more correct — kept as a zero-risk correctness fix.date.tsandButton.tsxin-codeBUG:comments were misdiagnosing the actual causes; docblocks were updated to match the real fixes.aria-labela required prop wheniconOnly— a breakingPropsAPI change that would conflict with the current test contract.Constraints honoured