Skip to content

fix: repair 5 failing tests across ui, utils, and web packages - #169

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier3-2216-1789000638
Open

fix: repair 5 failing tests across ui, utils, and web packages#169
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier3-2216-1789000638

Conversation

@stooit

@stooit stooit commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Repairs all failing tests in the monorepo. Baseline was 8 pass / 5 fail (via bun run test) plus type errors; now 13 pass / 0 fail and npx tsc --noEmit is clean (exit 0). No test files modified, no dependencies added.

Bugs fixed

  • Renamed hook (packages/utilsapps/web). A debounce hook was renamed upstream but apps/web/src/lib/api.ts still imported the old name. @e2e/utils now exports useSearchDebounce (alias of useDebounce, same identity) and the consumer import is reconciled. (fixes api.test.ts)
  • Missing accessibility attribute (packages/ui Button). aria-label was destructured but never applied to the <button> element. It's now forwarded, with a fallback accessible name for icon-only buttons (WCAG 2.2 SC 4.1.2). Uses React.Children.toArray + type guard so element children are never stringified. (fixes 2 Button.test.tsx cases)
  • Wrong date format (packages/utils). formatDate returned 01/03/2024 (leading-zero day). en-AU forces a 2-digit day regardless of day: "numeric" under this ICU build; switched to en-GB, which shares AU day/month/year ordering and / separator but honours un-padded day → 1/03/2024. The 15/06/2024 case is unaffected. (fixes date.test.ts)
  • Stale-closure bug (packages/ui DataTable). Sort direction was read from a captured variable. Sort key + direction collapsed into a single useState object updated by one pure functional updater — StrictMode-safe, no stale read. (keeps the "sorts descending on second click" test green)
  • Typecheck (tsconfig.json). Registered the already-installed bun-types with the compiler, clearing 4 pre-existing Cannot find module 'bun:test' errors.

Verification

  • bun run test -> 13 pass / 0 fail
  • npx tsc --noEmit -> exit 0
  • Independent review: no blockers, all fixes confirmed to address root causes (ICU day-padding and StrictMode purity claims empirically falsification-tested).

Assumptions & notes

  • Ran tests via bun run test (the npm script), which preloads the happy-dom setup. Plain bun test reports false document is not defined errors because the preload isn't applied.
  • Scope kept to what the tests require. Reviewer flagged non-blocking follow-ups outside this scope: type-level enforcement of aria-label on icon-only buttons, formatDate/formatDateTime locale consistency, and keeping the "search" alias in the consumer rather than the shared package.

- fix(web): reconcile renamed debounce hook — export useSearchDebounce
  from @e2e/utils and fix stale import in apps/web/src/lib/api.ts
- fix(a11y): apply aria-label to icon-only Button with a fallback
  accessible name (WCAG 2.2 SC 4.1.2)
- fix(utils): format dates day-first without leading zero via en-GB
  locale (en-AU forces 2-digit day under this ICU build)
- fix(ui): collapse DataTable sort key+direction into one state atom
  with a pure functional updater, removing a stale-closure bug
- chore(tsconfig): register bun-types with the compiler
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant