Skip to content

fix: repair cross-package test failures and clean type errors - #124

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier3-2218-1787004740
Open

fix: repair cross-package test failures and clean type errors#124
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier3-2218-1787004740

Conversation

@stooit

@stooit stooit commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all failing tests and eliminates all type errors across the monorepo. Baseline was 8 pass / 5 fail plus a tsc error; now 13 pass / 0 fail and npx tsc --noEmit exits 0 with no output.

Changes

  • apps/web/src/lib/api.ts — the useThrottle hook was renamed to useDebounce in packages/utils, but the app still imported the old name (TS2305). Updated the import to useDebounce and re-exported it as useSearchDebounce (which the api test asserts). Merged the two duplicate @e2e/utils imports.
  • packages/ui/src/components/Button/Button.tsxiconOnly buttons never applied aria-label, leaving them with no accessible name (WCAG 2.2 SC 4.1.2). Now applies aria-label with a fallback chain: explicit label → string children → "Button", so an icon-only button always has a non-null accessible name.
  • packages/utils/src/format/date.tsformatDate emitted a zero-padded day (01/03/2024); the test expects an unpadded day (1/03/2024). Reimplemented with Intl.DateTimeFormat.formatToParts under en-AU, producing an unpadded day while keeping a 4-digit year. (Ordering was never the bug — Intl ignores option order; the failing assertion was day padding.)
  • tsconfig.json — added "types": ["bun-types"] so bun:test resolves under tsc --noEmit (the 4 remaining bun:test TS2307 errors). bun-types was already installed; it just wasn't registered. Verified @types/react still resolves via the module import graph, so nothing regressed.

Verification

  • bun run test13 pass / 0 fail
  • npx tsc --noEmitexit 0, clean

Constraints honoured

  • No test files modified.
  • No dependencies added (package.json / lockfile untouched).
  • Fixed only what the tests require.

Assumptions & decisions

  • Date format: chose formatToParts over dateStyle: "short" to keep an unambiguous 4-digit year (1/03/2024) rather than 1/3/24; both would pass the test.
  • Button dev-warning removed: an earlier draft added a process.env.NODE_ENV dev-console.warn to Button. Since packages/ui ships as raw source (main → ./src/index.ts), process may be undefined in a browser bundler → ReferenceError at render. No test required it, so it was removed as a latent hazard.
  • aria-hidden on the icon not added: would have created a nameless-button regression for <Button icon /> used without iconOnly (the fallback is gated on iconOnly). Left the icon wrapper unchanged.

Known-remaining (out of scope — tests pass, not touched)

  • DataTable.tsx carries a documented stale-closure bug in handleSort, but its tests pass — left untouched per "fix only what tests require". Worth a follow-up issue.
  • formatDate depends on the ambient timezone; adding timeZone: "UTC" was avoided since it would render wrong dates for real AU users. Tests are stable across UTC/Sydney/Perth.

Fix all failing tests and eliminate type errors across the monorepo:

- apps/web: rename stale useThrottle import to useDebounce and
  re-export as useSearchDebounce (packages/utils renamed the hook)
- packages/ui Button: apply aria-label to icon-only buttons with a
  string-children/'Button' fallback so iconOnly buttons always have an
  accessible name (WCAG 2.2 SC 4.1.2)
- packages/utils formatDate: emit an unpadded day (1/03/2024) using
  Intl formatToParts under en-AU, keeping a 4-digit year
- tsconfig: register bun-types so bun:test resolves under tsc --noEmit

bun run test: 13 pass / 0 fail. npx 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