Skip to content

fix: repair cross-package bugs so all tests and typecheck pass - #170

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier3-2165-1789007323
Open

fix: repair cross-package bugs so all tests and typecheck pass#170
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier3-2165-1789007323

Conversation

@stooit

@stooit stooit commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all failing tests and type errors in the monorepo. Before: 8 pass / 5 fail and 5 tsc errors. After: 13 pass / 0 fail and tsc --noEmit clean (exit 0). No test files were modified and no dependencies were added.

Fixes by area

  • Renamed hook (packages/utilsapps/web)apps/web/src/lib/api.ts imported useThrottle, which no longer exists in @e2e/utils (renamed to useDebounce). Updated the import and re-exported it as useSearchDebounce (the name the test consumes); collapsed duplicate @e2e/utils imports. Resolves the useThrottle TS2305 error and both api module tests.
  • Missing accessibility attribute (packages/ui)Button dropped aria-label for icon-only buttons. Now applies it to the rendered element, with a trim-aware fallback + dev-only console.warn when an icon-only button has no usable label (WCAG 2.2 SC 4.1.2). Resolves both Button aria-label tests.
  • Date formatting locale/format (packages/utils)formatDate zero-padded the day (01/03/2024); the test requires day-first without leading zero (1/03/2024). Reassembles en-AU formatToParts output so the day is unpadded while separators/order come from the locale. Resolves the formatDate test.
  • Type resolution (tsconfig.json) — added "types": ["bun-types"] so bun:test declarations resolve. bun-types was already an installed devDependency — no new dependency added. Clears the 4 remaining TS2307 errors.

Verification

  • bun test packages/utils/test packages/ui/test apps/web/test --preload ./packages/ui/test/setup.ts -> 13 pass / 0 fail
  • npx tsc --noEmit -> zero output, exit 0

Notes / assumptions

  • The DataTable "stale closure" test passes as-is — the latent stale-closure bug at DataTable.tsx does not manifest under test because React 18's act() flushes state between fireEvent.click calls. Per the task's "fix only what tests require," it was left untouched, but it remains a latent bug worth hardening separately (along with the <th onClick> keyboard-operability gap, SC 2.1.1).
  • The icon-only Button fallback label ("Button") is a safety net that satisfies the test's not.toBeNull() assertion; a compile-time requirement would be a breaking API change and would fail the unmodifiable tests. Deferred as a follow-up.

- api.ts: import renamed useDebounce from @e2e/utils, re-export as
  useSearchDebounce (stale useThrottle import removed), collapse dup imports
- Button.tsx: apply aria-label to icon-only buttons with trim-aware
  fallback + dev warning (WCAG 2.2 SC 4.1.2)
- date.ts: format en-AU dates day-first without zero-padding the day
  via formatToParts reassembly
- tsconfig.json: add bun-types to compilerOptions.types so bun:test
  declarations resolve (dependency already installed)
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