fix: repair test harness, cross-package imports, and formatting bugs - #136
Open
stooit wants to merge 1 commit into
Open
fix: repair test harness, cross-package imports, and formatting bugs#136stooit wants to merge 1 commit into
stooit wants to merge 1 commit into
Conversation
Fix all failing tests and type errors across the monorepo: - bunfig.toml: replace ignored Vitest `environment` key with a bun `preload` of the happy-dom global registrator so DOM is available in packages/ui component tests (fixes "document is not defined"). - apps/web/src/lib/api.ts: import/re-export `useDebounce` (renamed from the now-nonexistent `useThrottle`) from @e2e/utils. - packages/ui Button: apply the destructured aria-label to the element and warn on unlabelled icon-only buttons (WCAG 2.2 SC 4.1.2). - packages/ui DataTable: use functional setState for the sort-direction toggle to eliminate the stale-closure defect. - packages/utils date: use Intl formatToParts with an unpadded day so en-AU output is day-first without a leading zero (1/03/2024). - tsconfig.json: add bun-types so `bun:test` imports type-check. 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. Baseline was 4 pass / 9 fail with 5
tscerrors; now 13 pass / 0 fail andbunx tsc --noEmitexits clean.Bugs fixed (spanning all three packages)
bunfig.toml)environment = "happy-dom"is a Vitest key Bun silently ignores, so no DOM ever registered — every@testing-library/reactrender threwdocument is not defined.preloadof the happy-dom global registrator setup.apps/web/src/lib/api.ts)useThrottlefrom@e2e/utils, which had been renamed.useDebounce; the underlying hook is a genuine debounce souseSearchDebounce's semantics now match its name.packages/uiButton)aria-labelwas destructured but never applied to the element.packages/uiDataTable)sortDir.setSortDir(prev => ...)so a net-2-toggle is a true no-op.packages/utils)01/03/2024).Intl.formatToPartswith an unpadded day gives1/03/2024, year preserved as 4 digits, TZ-robust.tsconfig.json)bun:testimports failedTS2307.bun-typestocompilerOptions.types.Verification
bun test-> 13 pass / 0 failbunx tsc --noEmit-> exit 0Constraints upheld
package.json/ lockfile untouched).Assumptions / notes
BUGcomments diagnosed the date bug asMM/DD/YYYYfield ordering; the actual defect was a leading zero on the day (dateStyle: "short"would have truncated the year), so the fix targets padding, not ordering.aria-labelcompile-time-required via a discriminated union wheniconOnly; consider a per-suite DOM env rather than a global preload.