fix: repair failing tests and type errors across monorepo - #129
Open
stooit wants to merge 1 commit into
Open
Conversation
- api.ts: fix stale import of renamed hook (useThrottle -> useDebounce), keep useSearchDebounce alias the test expects - bunfig.toml: register happy-dom via preload so document is defined in tests - Button.tsx: forward aria-label so icon-only buttons have an accessible name (WCAG 2.2 SC 4.1.2), scoped to iconOnly to avoid Label-in-Name issues - DataTable.tsx: fix stale-closure sort toggle with functional setState updater - date.ts: format day without zero-padding via en-AU formatToParts - tsconfig.json: add bun-types so bun:test resolves (no new dependency)
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 eliminates all
tsc --noEmittype errors across the bun-workspaces monorepo. Result: 13 pass / 0 fail,tscclean.Root causes & fixes
apps/web/src/lib/api.tsuseThrottlefrom@e2e/utils(no longer exists)useDebounce; keepuseSearchDebouncealias the test expectsbunfig.tomlenvironment = "happy-dom"is a no-op in Bun →document is not definedin ui testspreloadpackages/ui/.../Button.tsxaria-labelnever applied)aria-label(WCAG 2.2 SC 4.1.2), scoped toiconOnly; dev warning + fallbackpackages/ui/.../DataTable.tsxsortDirsetSortDir(prev => ...)updaterpackages/utils/.../date.tsformatDatezero-padded day (01/03/2024); test expects1/03/2024en-AUformatToParts, strip day zero-padtsconfig.jsonbun:testunresolved (TS2307)"types": ["bun-types"](dep already present)Verification
bun test-> 13 pass / 0 failnpx tsc --noEmit-> 0 errorsAssumptions / notes
Buttonfallback gives icon-only buttons without a label the generic name"Button"plus a dev-time warning - chosen because requiringaria-labelvia the type system would make an existing test a compile error (tests are unmodifiable per task constraints).Button"Button"fallback masks a missing label from a11y tooling;formatDateandformatDateTimenow render years differently. Both out of scope for the failing tests.