Skip to content

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

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier3-2190-1789229827
Open

stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier3-2190-1789229827

Conversation

@stooit

@stooit stooit commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all 5 failing tests and all source-code type errors in the monorepo. Four bugs spanning packages/utils, packages/ui, and apps/web — each isolated and fixed without touching test files or adding dependencies.

Bugs fixed

Bug File Fix
Renamed hook / broken import apps/web/src/lib/api.ts The hook in packages/utils was renamed to useDebounce; api.ts was importing a non-existent useThrottle. Now imports useDebounce and re-exports it as useSearchDebounce (the name api.test.ts asserts on). Resolves both the test failure and the TS2305 typecheck error.
Missing a11y attribute packages/ui/src/components/Button/Button.tsx Icon-only Button did not forward aria-label to the rendered element. Now forwarded, with a dev-mode warning and a fallback so an icon-only button always has a non-null accessible name (WCAG 2.2 SC 4.1.2).
Stale closure sort bug packages/ui/src/components/DataTable/DataTable.tsx Sort direction was read from a stale closure, so a second header click didn't toggle asc→desc. Switched to the functional setSortDir(prev => ...) updater.
Date format/locale packages/utils/src/format/date.ts formatDate zero-padded the day (01/03/2024). Now strips the day's leading zero while keeping en-AU day-first ordering and a 4-digit year (1/03/2024), satisfying all date assertions.

Verification

  • bun run test -> 13 pass, 0 fail
  • bun run typecheck -> no source errors. The only remaining diagnostics are four pre-existing Cannot find module 'bun:test' errors on test files (missing Bun test-runtime type declarations); left as-is because test files must not be modified and no dependencies may be added.

Assumptions

  • useSearchDebounce is the canonical export name (the API test asserts on it); the underlying implementation is the renamed useDebounce.
  • The four bun:test typecheck errors are environmental (test-runtime types) and out of scope under the "do not modify test files / do not add dependencies" constraints.
  • For the date fix, en-AU + formatToParts (to strip day zero-padding) was chosen over dateStyle:"short" (which yields a 2-digit year and breaks other assertions).

- api: import renamed useDebounce hook and re-export as useSearchDebounce
  (was importing non-existent useThrottle, breaking api.test and typecheck)
- Button: forward aria-label to the rendered button for icon-only buttons,
  with a dev warning + fallback so an accessible name is always present (WCAG 4.1.2)
- DataTable: use functional state updater for sort direction to fix stale
  closure so asc→desc toggles on the second header click
- date: strip zero-padding on the day part while keeping en-AU day-first
  ordering (1/03/2024 instead of 01/03/2024)
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