fix: repair cross-package test and type failures#70
Open
stooit wants to merge 1 commit into
Open
Conversation
- api.ts: update import to renamed useDebounce hook (was useThrottle) - date.ts: format 1 March 2024 as 1/03/2024 (DD/MM/YYYY, UTC) - bunfig.toml: preload happy-dom setup so DOM globals exist at repo root - Button.tsx: always apply aria-label on icon-only buttons - DataTable.tsx: functional setState to fix stale-closure sort toggle - tsconfig.json: add bun-types and include app sources for type checking
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.
bun test→ 13 pass, 0 fail;tsc --noEmit→ exit 0, no errors.Root causes & fixes
apps/web/src/lib/api.ts— Hook was renameduseThrottle→useDebounceinpackages/utils, but the old name was still imported/re-exported. Updated the import and theuseSearchDebouncere-export.packages/utils/src/format/date.ts—formatDateproduced a leading-zero day (01/03/2024). Rewrote to outputDD/MM/YYYYwith unpadded day and zero-padded month (1/03/2024), using UTC accessors.bunfig.toml— Component tests failed withdocument is not definedfrom the repo root because the happy-dom setup wasn't preloaded. Addedpreloadof the UI test setup.packages/ui/src/components/Button/Button.tsx— Icon-only buttons never applied an accessible name. Now always appliesaria-label.packages/ui/src/components/DataTable/DataTable.tsx— Stale-closure bug in the sort toggle. Switched to a functional state updater so a second click toggles to descending.tsconfig.json— Addedbun-typestocompilerOptions.types(already installed) sobun:testresolves, and included app sources. Resolves the 4 pre-existingCannot find module 'bun:test'errors.Verification
bun test: 13 pass, 0 failnode_modules/.bin/tsc --noEmit: exit 0Constraints honoured
bun-typesalready present). Changes minimal, root-cause fixes, independently reviewed.Assumptions
useThrottle→useDebouncerename is intentional; the fix updates consumers rather than restoring the old export.formatDateis expected to be UTC-based / locale-independent (matches all date-test assertions).