fix: repair 4 cross-package bugs so all tests and tsc pass - #141
Open
stooit wants to merge 1 commit into
Open
Conversation
- api.ts: import renamed useDebounce hook (exported as useSearchDebounce), fixes TS2305 - Button: add fallback aria-label + dev warning for icon-only buttons [WCAG 4.1.2] - formatDate: use en-AU dateStyle:"short" for day-first unpadded output - tsconfig: add types ["bun-types","react"] so bun:test resolves under tsc without dropping @types/react All 13 tests pass; tsc --noEmit exits clean. No test files or dependencies changed.
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. The correct test command is
bun test packages/utils/test packages/ui/test apps/web/test --preload ./packages/ui/test/setup.ts(the barebun testmisses the happy-dom preload, which manifests as spuriousdocument is not definederrors — not a real bug).Result: 13 pass / 0 fail,
tsc --noEmitexits 0.Bugs fixed
apps/web/src/lib/api.tsimporteduseThrottlefrom@e2e/utils, which no longer exists (the hook was renamed touseDebounce). Updated the import and theuseSearchDebouncere-export. Resolves the twoapi moduletest failures and TS2305.packages/ui/.../Button.tsxicon-only buttons had noaria-label. Now forwards a suppliedaria-labeland falls back to a generic label (with a dev-onlyconsole.warn) for icon-only buttons that lack one, satisfying WCAG 4.1.2.aria-labelremains optional. Resolves the two Button test failures.packages/utils/.../date.tsformatDateproduced a zero-padded day (01/03/2024); the test requires day-first unpadded output. Switched todateStyle: "short"(en-AU), matching the existingformatDateTime. Resolves theformatDatefailure.Type errors
tscreportedCannot find module 'bun:test'becausebun-typesinstalls outsidenode_modules/@types/and was never auto-included. Added"types": ["bun-types", "react"]totsconfig.json—reactpreserves the@types/reactresolution that automatic inclusion provided (verified JSX type-checking still enforces).Constraints honoured
git diff --stat -- '**/test/**'empty).bun-typesand@types/reactalready installed.Assumptions
formatDatenow emits a 2-digit year (dateStyle:"short"). No test asserts the year; chosen for minimal diff and consistency withformatDateTime. AformatToPartsvariant could preserve a 4-digit year if downstream consumers require it.