fix: repair cross-package test and type failures - #150
Open
stooit wants to merge 1 commit into
Open
Conversation
- api.ts: import renamed hook (useThrottle -> useDebounce) from @e2e/utils; public useSearchDebounce alias unchanged - Button: apply aria-label with iconOnly fallback + dev warning for WCAG 2.2 SC 4.1.2 - date.ts: use Intl formatToParts for unpadded day under en-AU - bunfig.toml: preload happy-dom setup so @testing-library/react has a DOM - tsconfig.json: add bun-types so 'bun:test' resolves No test files or dependencies modified. bun test: 13 pass / 0 fail. tsc --noEmit: clean.
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. Bugs spannedpackages/ui,packages/utils,apps/web, plus two test-environment config gaps.Result:
bun test→ 13 pass / 0 fail (was 4 pass / 9 fail);tsc --noEmit→ clean (was 5 errors).Changes (5 files, +34/−32)
apps/web/src/lib/api.ts— hook was renameduseThrottle→useDebounceinpackages/utils; updated the import. The publicuseSearchDebouncealias is unchanged, so no consumer contract shifts.packages/ui/src/components/Button/Button.tsx— applyaria-label, with aniconOnlyfallback and a dev-only warning (WCAG 2.2 SC 4.1.2, ES8 aligned).packages/utils/src/format/date.ts— useIntl.DateTimeFormat.formatToPartsto emit an unpadded day underen-AU(1/03/2024, not01/03/2024).bunfig.toml—preloadthe happy-dom setup so@testing-library/reacthas a DOM (the old[test].environmentkey is inert in Bun; DOM tests were erroring withdocument is not defined).tsconfig.json— addbun-typessoimport ... from "bun:test"resolves.Constraints honoured
package.json/ lockfile changes).Assumptions
useThrottlename.formatDateTimeuntouched as it was not under test.Reviewer follow-ups (out of scope; not test-required)
iconOnlyaria-labelfallback resolves to a generic"Button"to satisfy the (unmodifiable) test. Type-level enforcement (discriminated union oniconOnly) is cleaner but failsButton.test.tsx, so it is blocked by the "don't modify tests" constraint. Recommend descriptive labels at call sites.formatDate(4-digit year) andformatDateTime(2-digit year) use different conventions; worth aligning.formatDateis locale-pinned (en-AU) but not timezone-stable; addingtimeZone: "Australia/Sydney"would make output deterministic.