Skip to content

fix: repair 4 cross-package bugs so all tests and tsc pass - #141

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier3-2172-1788020200
Open

fix: repair 4 cross-package bugs so all tests and tsc pass#141
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier3-2172-1788020200

Conversation

@stooit

@stooit stooit commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all failing tests and type errors across the monorepo. The correct test command is bun test packages/utils/test packages/ui/test apps/web/test --preload ./packages/ui/test/setup.ts (the bare bun test misses the happy-dom preload, which manifests as spurious document is not defined errors — not a real bug).

Result: 13 pass / 0 fail, tsc --noEmit exits 0.

Bugs fixed

  1. Renamed hook importapps/web/src/lib/api.ts imported useThrottle from @e2e/utils, which no longer exists (the hook was renamed to useDebounce). Updated the import and the useSearchDebounce re-export. Resolves the two api module test failures and TS2305.
  2. Missing accessibility attributepackages/ui/.../Button.tsx icon-only buttons had no aria-label. Now forwards a supplied aria-label and falls back to a generic label (with a dev-only console.warn) for icon-only buttons that lack one, satisfying WCAG 4.1.2. aria-label remains optional. Resolves the two Button test failures.
  3. Date locale/formatpackages/utils/.../date.ts formatDate produced a zero-padded day (01/03/2024); the test requires day-first unpadded output. Switched to dateStyle: "short" (en-AU), matching the existing formatDateTime. Resolves the formatDate failure.
  4. DataTable "stale closure" test — verified already passing; no change needed.

Type errors

tsc reported Cannot find module 'bun:test' because bun-types installs outside node_modules/@types/ and was never auto-included. Added "types": ["bun-types", "react"] to tsconfig.jsonreact preserves the @types/react resolution that automatic inclusion provided (verified JSX type-checking still enforces).

Constraints honoured

  • No test files modified (verified: git diff --stat -- '**/test/**' empty).
  • No new dependenciesbun-types and @types/react already installed.
  • Only the 4 required areas touched.

Assumptions

  • formatDate now emits a 2-digit year (dateStyle:"short"). No test asserts the year; chosen for minimal diff and consistency with formatDateTime. A formatToParts variant could preserve a 4-digit year if downstream consumers require it.
  • The icon-only fallback label satisfies "has an accessible name" mechanically; the dev warning flags each call site to supply a descriptive label.

- api.ts: import renamed useDebounce hook (exported as useSearchDebounce), fixes TS2305
- Button: add fallback aria-label + dev warning for icon-only buttons [WCAG 4.1.2]
- formatDate: use en-AU dateStyle:"short" for day-first unpadded output
- tsconfig: add types ["bun-types","react"] so bun:test resolves under tsc without dropping @types/react

All 13 tests pass; tsc --noEmit exits clean. No test files or dependencies changed.
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