Skip to content

fix: repair cross-package test failures and typecheck errors - #166

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier3-2178-1788985731
Open

fix: repair cross-package test failures and typecheck errors#166
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier3-2178-1788985731

Conversation

@stooit

@stooit stooit commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all failing tests and eliminates all tsc --noEmit errors across the monorepo. Bugs spanned three packages and one config file. No test files were modified and no dependencies were added.

Result: bun run test13 pass / 0 fail; npx tsc --noEmitclean (exit 0).

Fixes

Area Bug Fix
apps/web/src/lib/api.ts Imported useThrottle from @e2e/utils, which was renamed to useDebounce (TS2305; broke both api module tests) Import useDebounce and re-export it as useSearchDebounce; consolidate imports
packages/ui/src/components/Button/Button.tsx aria-label was destructured but never applied to the <button> (accessibility test failed) Apply aria-label; for icon-only buttons with no explicit label, fall back to string children (else a generic name) and warn in dev — WCAG 2.2 SC 4.1.2. Text buttons still omit the attribute so visible labels aren't clobbered
packages/utils/src/format/date.ts Produced zero-padded day 01/03/2024; test expects unpadded day-before-month Use en-AU with unpadded day → 1/03/2024 (4-digit year, DD/MM ordering preserved)
tsconfig.json Cannot find module 'bun:test' for all test files Add "types": ["bun-types"] (already a devDependency); make DOM lib explicit; also typecheck apps/*/test (previously an untypechecked gap)
packages/ui/src/components/DataTable/DataTable.tsx No actual bug — all DataTable tests already passed Behaviour-neutral refactor to a functional setSortDir updater + removed a misleading "stale closure" comment. No failing test depended on this

Verification

  • bun run test → 13 pass / 0 fail (the single console line during the run is the intentional dev-mode WCAG warning from the icon-only-without-label test)
  • npx tsc --noEmit → no output, exit 0

Assumptions / notes

  • Date format: the test comment states the desired output is 1/03/2024 (unpadded day), so formatDate uses an unpadded day rather than the conventional zero-padded 01/03/2024. Chose to honour the test's stated intent.
  • Button fallback: the icon-only-without-label test requires a non-null aria-label, so a generic "button" fallback is used when no label and no string children are available. A dev-mode console.warn is emitted to drive callers to supply a real label; consider a lint rule for genuine 4.1.2 conformance.
  • DataTable: the task hinted at a stale-closure bug here, but investigation confirmed the tests already passed and the closure was not actually stale. The change made is a defensive refactor only — no behaviour change.
  • tsconfig: tsc --noEmit was already failing on main due to the missing bun-types; this PR also fixes that pre-existing break.

🤖 Generated with QuantCode

Make all 13 tests pass and clear all tsc errors across the monorepo:

- api.ts: import the renamed hook (useThrottle -> useDebounce) from
  @e2e/utils and re-export it as useSearchDebounce, fixing the broken
  import that failed both api module tests (TS2305).
- Button: apply aria-label to the rendered button. For icon-only buttons
  with no explicit label, fall back to string children (else a generic
  name) so they carry an accessible name (WCAG 2.2 SC 4.1.2), and warn in
  dev. Text buttons still omit the attribute so visible labels win.
- formatDate: use en-AU with an unpadded day (1/03/2024, not 01/03/2024)
  matching the test's expected day-before-month output.
- tsconfig: add "types": ["bun-types"] so tsc resolves bun:test; also make
  the DOM lib explicit and typecheck apps/*/test (previously a gap).
- DataTable: behaviour-neutral switch to a functional setSortDir updater
  and removal of a misleading "stale closure" comment (defensive refactor;
  no failing test — all DataTable tests already passed).

No test files modified; no dependencies added.
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