Skip to content

fix: repair failing cross-package tests and type errors - #149

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier3-2173-1788383999
Open

fix: repair failing cross-package tests and type errors#149
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier3-2173-1788383999

Conversation

@stooit

@stooit stooit commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all 9 failing tests and all type errors across the monorepo. After these changes bun test reports 13 pass / 0 fail and tsc --noEmit exits 0. No test files were modified and no dependencies were added.

The bugs spanned all three packages plus test-environment configuration. Root causes were identified via a plan investigation, implemented via code, and confirmed via a review pass.

Fixes

# File Bug Fix
1 apps/web/src/lib/api.ts Imported useThrottle, which was renamed to useDebounce in @e2e/utils — the failed import aborted module evaluation, failing both api.test.ts cases Import useDebounce; keep the public useSearchDebounce alias unchanged
2 packages/ui/.../Button/Button.tsx ariaLabel prop was destructured but never rendered — icon-only buttons had no accessible name (WCAG 2.2 SC 4.1.2) Apply aria-label for icon-only buttons with a trimmed fallback chain (explicit label -> string children -> "Button") plus a dev-only console.warn; non-icon buttons still get no attribute
3 packages/ui/.../DataTable/DataTable.tsx Sort direction used value-form setState, reading a render-scoped sortDir (stale closure) Functional updater setSortDir(prev => prev === "asc" ? "desc" : "asc")
4 packages/utils/src/format/date.ts formatDate zero-padded the day (01/03/2024) but the spec wants non-padded day-first (1/03/2024) Keep en-AU locale; de-pad the day via formatToParts. formatDateTime untouched
5 bunfig.toml [test] environment = "happy-dom" is not a valid key in Bun 1.4.0 and was silently ignored, so no DOM was registered for bare bun test (document is not defined) Replace with preload = ["./packages/ui/test/setup.ts"] (the setup file already registers happy-dom)
6 tsconfig.json bun:test module type declarations were not resolved (TS2307) Add "types": ["bun-types"]bun-types is already installed

Assumptions & decisions

  • Date format (item 4): kept the en-AU locale and used formatToParts to strip only the day's zero-padding, rather than switching to dateStyle: "short" (which would silently change every date display to a 2-digit year) or changing the locale tag.
  • Button fallback (item 2): the "Button" literal is a mechanical WCAG-passing safety net; the dev console.warn (gated on non-production) exists to push callers toward supplying a real label. Empty/whitespace ariaLabel on icon-only buttons is treated as "no label".
  • tsc scope (item 6): the bun:test errors were pre-existing config noise, but the task required eliminating all type errors, so they were fixed via tsconfig config only — no dependency added.
  • No test files were modified; a few stale BUG:/present-tense comments describing the now-fixed defects were updated so the source no longer misdescribes itself.

Verification

bun test        -> 13 pass, 0 fail
tsc --noEmit    -> exit 0

…e format

- api.ts: follow useThrottle->useDebounce rename in @e2e/utils, keep useSearchDebounce alias
- Button: apply aria-label to icon-only buttons with trimmed fallback + dev warning [WCAG 4.1.2]
- DataTable: use functional setState updater to fix sort-direction stale closure
- formatDate: emit non-padded day-first en-AU format via formatToParts
- bunfig.toml: register happy-dom via preload (invalid 'environment' key was ignored by bun)
- tsconfig.json: add bun-types so bun:test type declarations resolve

All 13 tests pass and tsc --noEmit is clean. 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