fix: repair failing tests and type errors across the monorepo - #156
Open
stooit wants to merge 1 commit into
Open
fix: repair failing tests and type errors across the monorepo#156stooit wants to merge 1 commit into
stooit wants to merge 1 commit into
Conversation
…hook rename - bunfig.toml: use preload for happy-dom setup so React component tests have a DOM (bare `bun test` previously threw 'document is not defined') - packages/utils/src/format/date.ts: emit day-first D/MM/YYYY with a 4-digit year (en-GB honours day: 'numeric'; en-AU zero-padded the day) - apps/web/src/lib/api.ts: useThrottle was renamed to useDebounce in @e2e/utils; update import, usage and re-export - packages/ui/.../Button.tsx: pass aria-label through for icon-only buttons, deriving a meaningful name from children when available - packages/ui/.../DataTable.tsx: use functional setState for the sort-direction toggle - tsconfig.json: add 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 failing tests and eliminates all type errors in the monorepo.
bun testnow reports 13 pass / 0 fail andtsc --noEmitexits clean. No test files were modified and no dependencies were added.Bugs fixed
bunfig.tomlenvironment = "happy-dom"is not a valid Bun key (silently ignored →document is not definedin React component tests). Switched topreloadof the happy-dom setup so the DOM is registered.packages/utils/src/format/date.tsformatDatezero-padded single-digit days (01/03/2024). Test expects day-first1/03/2024.en-AUresolvesday: 'numeric'to2-digit;en-GBhonours it — now emits unpadded day, 2-digit month, 4-digit year.apps/web/src/lib/api.tsuseThrottlewas renamed touseDebouncein@e2e/utils. Updated the import, usage and theuseSearchDebouncere-export.packages/ui/src/components/Button/Button.tsxaria-label. Now passes an explicit label through, falling back to a meaningful name derived from string children before a last-resort literal.packages/ui/src/components/DataTable/DataTable.tsxsortDirfrom the render closure. Switched to the functionalsetSortDir(prev => ...)form.tsconfig.json"types": ["bun-types"]sobun:testimports resolve undertsc.Verification
bun test→ 13 pass / 0 failtsc --noEmit→ exit 0Assumptions & notes
aria-labelfor icon-only buttons: the test only asserts a non-null label. The sound long-term fix is a discriminated union makingaria-labelmandatory wheniconOnlyis true, but that would require changing the test, so it's out of scope here. This PR derives a meaningful name from children where possible and keeps a"button"literal only as a last resort. Worth a follow-up ticket.en-GBlocale informatDate: produces byte-identical output to anen-AU+ zero-strip approach on tested dates while keeping the 4-digit year. Flagged as a latent trap ifweekday/month: 'long'are later added.formatDateTimeuntouched.bun-typesat root scope: minimal change that makesbun:testresolve; scoping it to test files via a dedicated tsconfig is a reasonable follow-up.🤖 Generated autonomously.