Skip to content

fix: resolve failing tests across ui, utils, and web packages - #117

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier3-2285-1786571991
Open

fix: resolve failing tests across ui, utils, and web packages#117
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier3-2285-1786571991

Conversation

@stooit

@stooit stooit commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all failing tests and type errors in the monorepo. bun run test now reports 13 pass / 0 fail and tsc --noEmit reports 0 errors. No test files were modified and no dependencies were added.

Changes

File Fix
apps/web/src/lib/api.ts The useThrottle hook was renamed to useDebounce in @e2e/utils, but api.ts still imported the old name. Updated the import and the useSearchDebounce re-export. Fixes both api.test.ts failures and the TS2305 error.
packages/ui/src/components/Button/Button.tsx Icon-only buttons had no accessible name. The ariaLabel prop was destructured but never applied. Now applied via aria-label, with a fallback for icon-only buttons and a dev-only console.warn when a label is missing (WCAG 2.2 SC 4.1.2).
packages/utils/src/format/date.ts formatDate zero-padded the day (01/03/2024); the test expects 1/03/2024. Switched from en-AU to en-GB with {day:"numeric", month:"2-digit", year:"numeric"} — same D/M/Y order, no day padding. formatDateTime left unchanged.
packages/ui/src/components/DataTable/DataTable.tsx Stale-closure hardening in handleSort: replaced setSortDir(sortDir === ...) with the functional updater setSortDir(prev => ...).
tsconfig.json Added "types": ["bun-types"] to resolve Cannot find module 'bun:test', and added apps/*/test/**/* to include (previously omitted, which is why the broken api.ts import wasn't caught by tsc).

Verification

  • bun run test → 13 pass / 0 fail
  • npx tsc --noEmit → 0 errors

Assumptions / notes

  • Button aria-label fallback: the "Button" fallback for an icon-only button with no label satisfies the test's non-null assertion but is a non-descriptive accessible name. The console.warn is intended to push callers toward a meaningful label. Enforcing a required label at the type level would be a breaking API change and is out of scope.
  • DataTable fix is latent-defect hardening — the stale closure was not reachable by the current tests, but the functional-updater form is correct and introduces no regression.
  • The [Button] iconOnly requires an aria-label line in test output is the expected dev warning from the intentional no-label test path, not a failure.

- api.ts: import renamed useDebounce hook and re-export as useSearchDebounce
- Button: apply aria-label to icon-only buttons for WCAG 4.1.2, warn on missing label
- DataTable: use functional setState updater in handleSort to avoid stale closure
- date: format day without leading zero via en-GB locale
- tsconfig: add bun-types and include apps test dirs for typechecking
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