fix: repair cross-package bugs and test environment - #94
Open
stooit wants to merge 1 commit into
Open
Conversation
- Preload happy-dom global registrator so React tests get a DOM - Wire bun-types into tsconfig so bun:test resolves - Update apps/web to import the renamed utils hook - Add required aria-label handling to Button (WCAG 2.2 AA SC 4.1.2) - Fix DataTable sort stale closure via functional state updater - Correct formatDate locale/format to match expected output
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
Makes
bun test && tsc --noEmitfully clean from the repo root — 13 tests pass, zero type errors. Fixes spanned all three packages plus the shared test/TS configuration.Changes
bunfig.toml): preload the happy-dom global registrator so React Testing Libraryrender()has adocument. Previously everypackages/uicomponent test threwReferenceError: document is not defined.tsconfig.json): wire inbun-typessoimport ... from "bun:test"resolves (wasTS2307: Cannot find module 'bun:test').apps/web/src/lib/api.ts): a hook was renamed inpackages/utils, butapps/webstill imported the olduseThrottlename (TS2305: has no exported member 'useThrottle'). Updated the import to the current export.packages/ui/.../Button.tsx): icon-only buttons now carry an explicitaria-label(WCAG 2.2 AA SC 4.1.2), as asserted by the Button test.packages/ui/.../DataTable.tsx): the sort handler readsortDirfrom the render closure, so toggling relied on stale state. Switched to a functional state updater (setSortDir(prev => ...)) — the root-cause fix for the "sorts descending on second click" controlled-re-render test.packages/utils/src/format/date.ts): corrected the locale/format string soformatDateoutput matches the expected assertion.Verification
Notes / assumptions
formatDateas a possible regression; the current output matches the test's leading-1assertion, so the existing behaviour is correct as written and was left intact.