Skip to content

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

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier3-2172-1788366046
Open

fix: repair cross-package test failures and type errors#147
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier3-2172-1788366046

Conversation

@stooit

@stooit stooit commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all 5 failing tests and all tsc --noEmit errors in the monorepo. Bugs spanned three packages. Verified green: bun run test13 pass / 0 fail, bunx tsc --noEmitexit 0.

Changes

File Fix
apps/web/src/lib/api.ts The useThrottle hook in packages/utils was renamed to useDebounce; the app still imported the old name (runtime SyntaxError + TS2305). Reconciled the import and re-export it as useSearchDebounce (the name the test expects). Aliasing is semantically honest — the underlying implementation is a genuine debounce.
packages/ui/.../Button.tsx aria-label was never forwarded to the <button>. Now forwarded; for iconOnly buttons with no label, falls back to "Unlabelled button" + a dev console.warn so an unlabelled button stays visible to accessibility scanners rather than being silently masked (WCAG 2.2 SC 4.1.2).
packages/ui/.../DataTable.tsx Sort-direction toggle now uses the functional state updater (setSortDir(prev => ...)), removing a latent stale-closure hazard flagged by the // BUG: comment.
packages/utils/.../date.ts formatDate returned 01/03/2024; the test requires an unpadded day (1/03/2024). Uses formatToParts with en-AU ordering and strips the leading zero from the day part only, keeping the documented 4-digit year.
tsconfig.json Added "types": ["bun-types", "react"] so bun:test resolves under tsc (the test files use it and are off-limits to edit).

Assumptions & notes

  • No test files were modified; no dependencies were added. All fixes are source-only.
  • The date.ts format is dictated by the test: two assertions (/^1/ for 1 March and a 4-digit year) are jointly unsatisfiable with plain Intl options in this ICU build, so formatToParts + day-zero-strip was the only path that satisfies both.
  • The DataTable change is a defensive correctness improvement — the "stale closure test" passed before and after because RTL flushes state between clicks. The functional updater is the correct idiom and matches the intent of the in-source // BUG: note (now removed).
  • The formatDate fixtures (T12:00:00Z) are timezone-fragile at extreme offsets — pre-existing in the unmodifiable test file, not a regression.

Verification

bun run test   → 13 pass / 0 fail
bunx tsc --noEmit → exit 0

- api.ts: reconcile stale useThrottle import with renamed useDebounce hook
- Button: forward aria-label and provide accessible-name fallback for icon-only
- DataTable: use functional state updater for sort-direction toggle
- date.ts: format day without leading zero via formatToParts (en-AU)
- tsconfig: register bun-types so bun:test resolves under tsc
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