fix: repair cross-package bugs breaking tests and typecheck - #165
Open
stooit wants to merge 1 commit into
Open
Conversation
- api.ts: import/re-export renamed useDebounce hook (was stale useThrottle) - bunfig.toml: preload happy-dom setup so bare 'bun test' has DOM globals - Button: provide accessible aria-label for icon-only buttons + dev warning - DataTable: fix sort-direction stale closure via functional state updater - date.ts: format en-AU date with unpadded day via Intl.formatToParts - tsconfig: add bun-types/react to resolve module type errors
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
Repairs all failing tests and type errors in the monorepo.
bun test→ 13 pass / 0 fail;bunx tsc --noEmit→ clean (exit 0). Bugs spanned all three packages (packages/ui,packages/utils,apps/web) plus build config.Fixes
apps/web/src/lib/api.tsuseThrottle); the real export inpackages/utilsisuseDebounce, causingSyntaxError: export 'useSearchDebounce' not founduseDebounce, keep the publicuseSearchDebouncealias so no caller breaksbunfig.toml[test].environment— not a real bun option, so it silently did nothing and DOM globals were missing →ReferenceError: document is not definedin all UI testspreloadmechanism to load the happy-dom setup so barebun testfrom the repo root has a DOMpackages/ui/.../Button.tsxaria-labelaria-label(explicit prop → string children →"Button"floor) with a dev-only warning when an icon-only button has no explicit labelpackages/ui/.../DataTable.tsxsetSortDir(sortDir === ...)reads the render-time captured value; two toggles in one batch produce the wrong direction and wrongaria-sortsetSortDir(prev => prev === "asc" ? "desc" : "asc")packages/utils/.../date.tsformatDateemitted a zero-padded day (01/03/2024); test requires an unpadded, day-first en-AU formatIntl.DateTimeFormat("en-AU").formatToPartsto strip the day's leading zero →1/03/2024tsconfig.jsonTS2307errors resolvingbun:testetc.bun-types(+react) tocompilerOptions.typesConstraints honoured
git difftouches no*.test.*orpackage.json).BUG:diagnostic comments removed from edited files for consistency.Assumptions / notes
aria-label="Button"fallback is a compliance floor to satisfy the test (Button.test.tsx:24renders an icon-only button with no label and expects it to still render). A type-level "require aria-label for iconOnly" was rejected because it would make the test file itself a type error. The dev warning mitigates the weak label.userEvent.formatDateandformatDateTimedisagree on year width (pre-existing).