fix: repair cross-package bugs breaking tests and type checks#65
Open
stooit wants to merge 1 commit into
Open
Conversation
- utils: format day/month without leading zeros in formatDate (en-AU) - utils/web: rename hook to useDebounce; re-export as useSearchDebounce - ui: pass through aria-label on icon-only Button, warn when missing - ui: fix stale-closure in DataTable sort toggle via functional updater - tsconfig: register bun-types so bun:test resolves in test files
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 run test→ 13/13 pass;bun run typecheck→ clean). Bugs spanned all three packages.Changes
packages/utils/src/format/date.ts—formatDatenow renders day and month without leading zeros foren-AU(e.g.1/3/2024), fixing the "day 1 not confused with month 1" test. UsesIntl.DateTimeFormat.formatToPartsbecause Bun's ICU zero-padsnumericday.apps/web/src/lib/api.ts— the hook was renamed inpackages/utils; updated the import from the non-existentuseThrottletouseDebounceand fixed theuseSearchDebouncere-export (resolves TS2305 + the api module test).packages/ui/src/components/Button/Button.tsx— icon-only buttons now pass througharia-labelverbatim, and emit a devconsole.warn(WCAG 4.1.2) when an icon-only button is missing an accessible name, matching the test's "should warn" intent.packages/ui/src/components/DataTable/DataTable.tsx— fixed a stale-closure bug in the sort-direction toggle by using the functional updater form ofsetSortDir, caught by the controlled re-render test.tsconfig.json— registeredbun-types(already installed) so test files resolvebun:test(resolves TS2307).Verification
bun run test→ 13 pass, 0 failbun run typecheck→ 0 errorsConstraints honoured
bun-typeswas already present).Assumptions
useDebounce(verified as the actual export inpackages/utils);useSearchDebounceis the public alias the app/test expects.aria-label, the test requires a warning (not a placeholder label); implemented asconsole.warn.1/3/2024) as the simplest form satisfying every date assertion.