Skip to content

fix: resolve cross-package test failures in monorepo - #159

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier3-2177-1788932211
Open

fix: resolve cross-package test failures in monorepo#159
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier3-2177-1788932211

Conversation

@stooit

@stooit stooit commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all 5 failing tests and the real type error across the monorepo. Baseline was 8 pass / 5 fail with one tsc error; now 13 pass / 0 fail and tsc clean.

Three bugs, spanning all three packages:

  • apps/web/src/lib/api.ts (hook rename mismatch). The app imported useThrottle from @e2e/utils, which no longer exists (tsc: Module @e2e/utils has no exported member useThrottle). The real export is useDebounce (trailing-edge debounce). Aligned the app import to useDebounce, aliased as useSearchDebounce — the name the test expects — without changing the hook's true semantics or renaming anything in a test file.
  • packages/ui/src/components/Button/Button.tsx (missing a11y attribute). Icon-only buttons rendered no accessible name. Added aria-label wiring so an icon-only button always exposes a non-null accessible name (WCAG 4.1.2), passing through a caller-supplied label verbatim.
  • packages/utils/src/format/date.ts (locale/format). formatDate(1 March 2024) returned zero-padded 01/03/2024; the test requires a day-first, non-padded leading day (/^1/). Switched to locale-aware en-AU formatting so it renders 1/03/2024.

The DataTable "sorts descending on second click" (stale-closure) test was verified to already pass — no change needed there.

Verification

  • bun run test -> 13 pass, 0 fail
  • ./node_modules/.bin/tsc --noEmit -> clean apart from pre-existing Cannot find module 'bun:test' errors in test files (present before this change; test-typing environment quirk, out of scope)

Constraints honoured

  • No test files modified
  • No dependencies added
  • Only the three source files above changed

Assumptions / notes for reviewers

  • Button fallback: when an icon-only button is given no children and no label, it falls back to aria-label="Button" to satisfy the test's not.toBeNull() assertion. This is a weak label; the cleaner long-term fix is a type-level requirement that iconOnly demands an aria-label, but that would require amending Button.test.tsx, which the task forbids.
  • Date presentation: formatDate uses day: numeric / month: 2-digit / 4-digit year to satisfy the test while keeping the full year; note formatDateTime in the same module uses a shorter style, so the two are not visually identical. Left as-is since no test requires alignment.
  • Pre-existing, out of scope: DataTable sort headers (<th onClick>) are not keyboard-operable (WCAG 2.1.1); a shared date util hardcodes en-AU with no explicit timeZone. Neither is introduced here and neither is covered by a failing test.

- api.ts: align app import to the real @e2e/utils export (useDebounce)
  aliased as useSearchDebounce, resolving the stale useThrottle import
- Button: add aria-label wiring for icon-only buttons so they expose an
  accessible name (WCAG 4.1.2)
- formatDate: use locale-aware en-AU day-first formatting so 1 March
  renders as 1/03/2024 (non-zero-padded day)

All 13 tests pass; tsc clean apart from pre-existing bun:test module
errors in test files.
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