fix: repair cross-package bugs so all tests pass and typecheck is clean - #167
Open
stooit wants to merge 1 commit into
Open
fix: repair cross-package bugs so all tests pass and typecheck is clean#167stooit wants to merge 1 commit into
stooit wants to merge 1 commit into
Conversation
- api.ts: import renamed hook (useDebounce) from @e2e/utils instead of stale name - date.ts: format 1 Mar 2024 as en-GB style day/month/year (no leading zero on day) - Button.tsx: forward aria-label so icon-only buttons expose an accessible name - DataTable.tsx: use functional state updater to fix stale-closure sort toggle - bunfig.toml: preload happy-dom global registrator so UI tests have a DOM - tsconfig.json + bun.d.ts: reference already-installed bun-types so bun:test resolves
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 eliminates all type errors across the monorepo (
packages/ui,packages/utils,apps/web). Final state:bun test→ 13 pass / 0 fail,npx tsc --noEmit→ 0 errors.Bugs fixed
apps/web/src/lib/api.ts) — the hook inpackages/utilswas renamed touseDebounce, but the app still imported the old name. Updated the consumer to import the real exported name so both the runtime import and the type check resolve.packages/utils/src/format/date.ts) —formatDatewas zero-padding the day (01/03/2024). Now formats 1 Mar 2024 as day/month/year with an unpadded day, matching the test's/^1/expectation.packages/ui/.../Button.tsx) — icon-only buttons did not expose an accessible name.aria-labelis now forwarded to the underlying<button>.packages/ui/.../DataTable.tsx) — replaced the state expression that read a stalesortDirwith a functional updater, so a second click correctly toggles to descending.Supporting changes (not source bugs, but required to run/verify)
bunfig.toml— wired up the already-installed@happy-dom/global-registratorpreload so the UI tests have a DOM (previously failing withdocument is not defined). No new dependency.tsconfig.json+ newbun.d.ts— added a triple-slash reference to the already-installedbun-typessobun:testresolves in test files, clearing the 4TS2307errors. Used a reference file rather thancompilerOptions.typesto preserve automatic@types/reactdiscovery. No test files modified, no new dependency.Constraints honoured
happy-domandbun-typeswere already innode_modules).Reviewer notes / assumptions
formatDateusesen-GBto get unpadded-day day/month/year output. Anen-AU+formatToPartsalternative was considered; either is defensible.aria-labelis provided (to satisfy the "still renders" test); a stricter type-level requirement would need a test edit, which is out of scope here.