Skip to content

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

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

fix: repair cross-package bugs so tests and typecheck pass#171
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier3-2172-1789057099

Conversation

@stooit

@stooit stooit commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all failing tests and type errors across the monorepo. Final state: 13/13 tests pass, tsc --noEmit clean (exit 0). No test files edited, no dependencies added.

Bugs fixed

  1. Renamed hook (apps/web/src/lib/api.ts)useThrottle was removed from @e2e/utils; the current export is useDebounce. Updated the consumer import (collapsing duplicate @e2e/utils imports) and preserved the public useSearchDebounce name the app test asserts.
  2. Button accessibility (packages/ui) — icon-only buttons now pass aria-label through to the <button>, exposing an accessible name (WCAG 2.2 SC 4.1.2). Without a label, a dev-only console.warn fires and a fallback name is applied so the accessible name is never null.
  3. DataTable sort (packages/ui) — consolidated sort key and direction into a single SortState object updated functionally, making toggle behaviour robust and internally consistent.
  4. formatDate (packages/utils) — emits a day-first Australian date with no leading zero on the day (e.g. 1/03/2024, 15/06/2024) via Intl.DateTimeFormat + formatToParts, matching the test expectations.

Supporting change

  • Added packages/utils/test/bun-types.d.ts — a /// <reference types="bun-types" /> shim scoped to the test tree so tsc resolves bun:test for all four test files. Placed under test/ (not src/) so Bun runtime globals do not leak into library/app source. This is a new type-reference file, not a test file.

Assumptions

  • The bunfig.toml/setup files are correct; the DOM environment initialises via the repo's test script preload (bun run test), the canonical invocation, which passes fully.
  • For bug 1, the intended fix was to update the consumer to the current export name rather than re-add the old hook (no test references useThrottle).
  • For bug 4, the day-first / no-leading-zero output is dictated by the test regex; en-AU pads the day even with day: "numeric", so the day is normalised via formatToParts while the locale still controls field order and separators.

Verification

  • bun run test → 13 pass, 0 fail
  • npx tsc --noEmit → exit 0

- api.ts: import renamed hook (useDebounce) from @e2e/utils instead of removed useThrottle
- Button: apply aria-label so icon-only buttons expose an accessible name (WCAG 4.1.2)
- DataTable: consolidate sort key/direction into a single SortState for robust toggling
- formatDate: emit day-first AU date without leading-zero on the day via formatToParts
- add bun:test type shim under packages/utils/test to resolve bun:test types for 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