Skip to content

fix: repair failing tests across api and shared packages#82

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier2-5230-1783528655
Open

fix: repair failing tests across api and shared packages#82
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier2-5230-1783528655

Conversation

@stooit

@stooit stooit commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all 9 failing tests and eliminates all tsc --noEmit errors across the api and shared packages. Baseline was 13 pass / 9 fail; now 22 pass / 0 fail and tsc --noEmit is clean.

Bugs fixed

  • Pagination util (packages/shared/src/utils/pagination.ts): was a stub throwing not implemented. Implemented 1-indexed paging — start = (page-1)*size, end-exclusive slice, totalPages = ceil(total/size) (0 for empty input).
  • Auth middleware case bug (packages/api/src/middleware/auth.ts): public-methods list held lowercase "post" but Hono reports methods uppercase, so POST /users was never treated as public. Changed to "POST".
  • Shared type field inconsistency (packages/shared/src/types.ts): User.userName renamed to username to match what the API route and tests use.
  • Missing import (packages/api/src/routes/users.ts): added badRequest to the import from ../lib/errors (already exported there) — was a runtime/type failure in the 400-validation path.
  • tsconfig (tsconfig.json): added "types": ["bun-types"] so process and the bun:test module resolve under tsc. bun-types was already installed — no new dependencies.

Verification

  • bun test → 22 pass, 0 fail (37 expect() calls, 4 files)
  • npx tsc --noEmit → clean (exit 0)
  • Independent review: APPROVE, no blockers.

Assumptions

  • Test files are the contract and were left unmodified; source was made to conform (notably the userNameusername direction, driven by the tests).
  • No new dependencies added; the tsconfig fix relies on the already-present bun-types.

- Implement paginate() util (was a stub throwing not-implemented)
- Fix auth middleware HTTP-method case bug (post -> POST) so POST /users is public
- Rename shared User field userName -> username to match API and tests
- Add missing badRequest import in users route handler
- Add bun-types to tsconfig types so process/bun:test resolve under 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