Skip to content

fix: repair cross-package test and type failures - #150

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier3-2228-1788386974
Open

fix: repair cross-package test and type failures#150
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier3-2228-1788386974

Conversation

@stooit

@stooit stooit commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all 9 failing tests and 5 tsc --noEmit errors across the monorepo. Bugs spanned packages/ui, packages/utils, apps/web, plus two test-environment config gaps.

Result: bun test → 13 pass / 0 fail (was 4 pass / 9 fail); tsc --noEmit → clean (was 5 errors).

Changes (5 files, +34/−32)

  • apps/web/src/lib/api.ts — hook was renamed useThrottleuseDebounce in packages/utils; updated the import. The public useSearchDebounce alias is unchanged, so no consumer contract shifts.
  • packages/ui/src/components/Button/Button.tsx — apply aria-label, with an iconOnly fallback and a dev-only warning (WCAG 2.2 SC 4.1.2, ES8 aligned).
  • packages/utils/src/format/date.ts — use Intl.DateTimeFormat.formatToParts to emit an unpadded day under en-AU (1/03/2024, not 01/03/2024).
  • bunfig.tomlpreload the happy-dom setup so @testing-library/react has a DOM (the old [test].environment key is inert in Bun; DOM tests were erroring with document is not defined).
  • tsconfig.json — add bun-types so import ... from "bun:test" resolves.

Constraints honoured

  • No test files modified.
  • No dependencies added (no package.json / lockfile changes).
  • Only what the tests require was changed.

Assumptions

  • Verified locally that no non-test consumer imports the old useThrottle name.
  • Kept formatDateTime untouched as it was not under test.

Reviewer follow-ups (out of scope; not test-required)

  • W1 — the iconOnly aria-label fallback resolves to a generic "Button" to satisfy the (unmodifiable) test. Type-level enforcement (discriminated union on iconOnly) is cleaner but fails Button.test.tsx, so it is blocked by the "don't modify tests" constraint. Recommend descriptive labels at call sites.
  • W3formatDate (4-digit year) and formatDateTime (2-digit year) use different conventions; worth aligning.
  • W4formatDate is locale-pinned (en-AU) but not timezone-stable; adding timeZone: "Australia/Sydney" would make output deterministic.

- api.ts: import renamed hook (useThrottle -> useDebounce) from @e2e/utils; public useSearchDebounce alias unchanged
- Button: apply aria-label with iconOnly fallback + dev warning for WCAG 2.2 SC 4.1.2
- date.ts: use Intl formatToParts for unpadded day under en-AU
- bunfig.toml: preload happy-dom setup so @testing-library/react has a DOM
- tsconfig.json: add bun-types so 'bun:test' resolves

No test files or dependencies modified. bun test: 13 pass / 0 fail. tsc --noEmit: clean.
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