Skip to content

fix: resolve cross-package test failures and type errors#37

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier3-2515-1781368811
Open

fix: resolve cross-package test failures and type errors#37
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier3-2515-1781368811

Conversation

@stooit

@stooit stooit commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all failing tests and type errors across the monorepo. Bugs spanned packages/utils, packages/ui, and apps/web. All changes are minimal and targeted; no test files were modified and no dependencies were added.

Final state: bun test → 13 pass / 0 fail, bunx tsc --noEmit → 0 errors.

Fixes

  1. Renamed hook import (apps/web/src/lib/api.ts) — useThrottle was renamed to useDebounce in packages/utils; the consumer still imported the old name. Updated the import to match the real export (re-exported as useSearchDebounce).
  2. Date formatter locale (packages/utils/src/format/date.ts) — explicit field options forced M/D/YYYY ordering regardless of locale. Switched to dateStyle: "short" so the locale controls D/M/Y ordering (e.g. 1 March 20241/3/..., not 3/1/...).
  3. Accessibility attribute (packages/ui/src/components/Button/Button.tsx) — icon-only buttons now apply aria-label, as asserted by the Button test.
  4. Stale-closure bug (packages/ui/src/components/DataTable/DataTable.tsx) — sort-direction toggle captured a stale value; replaced with a functional setState updater so it always reads committed state. Caught by a controlled re-render test.
  5. Test DOM environment (bunfig.toml) — root bun test did not load a DOM environment, so component tests threw document is not defined. Wired the root config to preload the existing packages/ui/test/setup.ts.
  6. Type globals (tsconfig.json) — added bun-types to types so tsc resolves the bun:test globals used in test files (type declarations were already installed; no new dependency).

Assumptions

  • The test files are the source of truth for the correct public hook name and expected date format; consumer/source code was reconciled to them.
  • The DOM preload setup file and bun-types were already present/installed, so wiring them required no new dependencies.

Testing

  • bun test from repo root: 13 pass, 0 fail
  • bunx tsc --noEmit from repo root: 0 errors
  • Independent code review: all five fixes confirmed correct, minimal, and regression-free.

- api.ts: update stale import (useThrottle -> useDebounce) after hook rename
- date.ts: use dateStyle 'short' so locale controls D/M/Y ordering
- Button.tsx: apply aria-label for icon-only buttons (a11y)
- DataTable.tsx: fix stale-closure sort toggle via functional setState updater
- bunfig.toml: preload packages/ui test setup so component tests get a DOM
- tsconfig.json: add bun-types so tsc resolves bun:test globals
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