Skip to content

fix: repair cross-package bugs so all tests and typecheck pass - #113

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier3-2163-1786378929
Open

fix: repair cross-package bugs so all tests and typecheck pass#113
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier3-2163-1786378929

Conversation

@stooit

@stooit stooit commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all failing tests and type errors across the monorepo. bun test && tsc --noEmit from the repo root now exits 0: 13/13 tests pass, zero type errors (was 4 pass / 9 fail, 5 type errors).

No test files were modified and no dependencies were added — only source and config.

Fixes

# Area File Fix
1 Renamed hook import mismatch apps/web/src/lib/api.ts Imported the real export useDebounce from @e2e/utils and re-exported it as useSearchDebounce (the name the test asserts).
2 Button accessibility packages/ui/src/components/Button/Button.tsx Forwarded aria-label to give icon-only buttons an accessible name (WCAG 2.2 SC 4.1.2), with a dev-time warning + fallback when omitted.
3 Date format packages/utils/src/format/date.ts Stripped the zero-pad on the day so en-AU output is day-first (1 March 2024 -> 1/03/2024), matching the "day 1 not confused with month 1" test.
4 DOM environment bunfig.toml Added preload = ["./packages/ui/test/setup.ts"] so happy-dom registers document when bun test is run directly from the repo root.
5 bun:test types tsconfig.json Registered bun-types so import ... from "bun:test" resolves (cleared 4 Cannot find module errors).

Assumptions / Notes

  • The "DataTable stale closure" test was not a real code bug. It was only failing because of the missing DOM globals (fix fix: resolve all failing tests across monorepo packages #4). Each fireEvent.click is a separate render, so the sort handler already closes over fresh state; the test passes with DataTable.tsx unmodified, so it was left untouched.
  • The Button fallback label prevents a hard WCAG 4.1.2 failure and satisfies the test's not.toBeNull() assertion while flagging the missing label in development. Enforcing a required aria-label at the type level would change the public API and break the existing test, so it was not done here.
  • Tests are treated as the source of truth; no test assertions were changed.

- api.ts: import the real hook export (useDebounce) and re-export as
  useSearchDebounce, fixing the renamed-hook import mismatch
- Button: forward aria-label for accessible name (WCAG 2.2 SC 4.1.2),
  with dev-time warning + fallback for icon-only buttons
- formatDate: strip zero-pad on day so en-AU output is day-first (1/03/2024)
- bunfig.toml: preload happy-dom setup so document is defined for root
  bun test
- tsconfig: register bun-types so bun:test resolves
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