fix: repair cross-package bugs so all tests and types pass - #127
Open
stooit wants to merge 1 commit into
Open
Conversation
- api.ts: import useDebounce (renamed hook) instead of stale useThrottle, preserving the useSearchDebounce public alias - date.ts: strip ICU day zero-pad so en-AU formatDate yields day-first without leading zero (1/03/2024) - bunfig.toml: register happy-dom via root preload so UI tests have a DOM when run from the repo root - Button.tsx: actually apply aria-label (never applied before) with an icon-only fallback and dev-only warning [WCAG 4.1.2] - DataTable.tsx: use functional setSortDir to fix stale-closure sort under React 18 batching - tsconfig.json: add bun-types so bun:test resolves No test files modified, no dependencies added.
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 testnow passes 13/13 (was 4/13) andtsc --noEmitexits clean (was 5 errors). No test files modified, no dependencies added.Fixes
apps/web/src/lib/api.tsuseDebounce(the real export) instead of the staleuseThrottle/useSearchDebounce, preserving theuseSearchDebouncepublic alias the test asserts onpackages/utils/src/format/date.tsen-AUformatDateyields day-first with no leading zero (1/03/2024). ICU resolvesday: "numeric"-> 2-digit for en-AU; fixed viaformatToParts. Original AU ordering was already correct — the only defect was zero-padding.bunfig.tomlpreloadso UI tests have adocumentwhen run from the repo root (the existingpackages/ui/bunfig.tomlonly applied when run from that package's cwd). Uses already-installed happy-dom — no new deps.packages/ui/src/components/Button/Button.tsxaria-label(it was never applied before, even when passed) with an icon-only fallback and a dev-only warning [WCAG 4.1.2]packages/ui/src/components/DataTable/DataTable.tsxsetSortDir((prev) => ...)to fix the stale-closure sort bug under React 18 batchingtsconfig.jsonbun-typessobun:testresolves in test filesVerification
bun test-> 13 pass / 0 fail./node_modules/.bin/tsc --noEmit-> exit 0git diff --name-onlyconfirms zero test files touched and nopackage.json/lockfile changesAssumptions & notes
iconOnlyand no label, the fallback is a generic string to satisfy WCAG SC 4.1.2. The robust fix — makingaria-labeltype-required wheniconOnly— is blocked because a test renders<Button iconOnly />with no label and tsconfig type-checks test files. A runtime fallback is the only path without touching tests. Recommend a follow-up ticket to audit realiconOnlycall sites and provide meaningful labels.D/MM/YYYY(unpadded day, padded month) to match the test's/^1/expectation with a minimal edit. A future decision could normalise padding for consistency withformatDateTime.