Skip to content

fix: repair failing tests and type errors across api and shared packages#88

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier2-2398-1784046925
Open

fix: repair failing tests and type errors across api and shared packages#88
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier2-2398-1784046925

Conversation

@stooit

@stooit stooit commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all failing tests and eliminates all tsc --noEmit type errors. bun test now reports 22 pass / 0 fail and tsc --noEmit exits clean.

Root causes fixed

  • Pagination utility (shared): paginate<T>() in packages/shared/src/utils/pagination.ts was a stub that threw not implemented. Implemented per the test contract — correct page slice, second/partial-last page, total/totalPages/page/pageSize fields, empty-array and out-of-range-page handling.
  • Auth middleware case bug: packages/api/src/middleware/auth.ts compared the HTTP method against lowercase "post", so POST /users was not treated as public. Fixed to uppercase "POST" to match c.req.method.
  • Shared type field mismatch: the User type used userName while routes and tests used username. Aligned the shared type to the canonical username.
  • Missing import: packages/api/src/routes/users.ts referenced badRequest without importing it. Added the import.
  • Type-check config: added "types": ["bun-types"] to tsconfig.json so bun:test imports and Bun/Node globals (e.g. process) resolve under tsc --noEmit.

Verification

  • bun test -> 22 pass, 0 fail
  • tsc --noEmit -> clean (exit 0)
  • Independent review pass confirmed correctness, no regressions.

Assumptions

  • username (lowercase) is the canonical field name — determined by reading the unmodified test files.
  • No test files modified; no new dependencies added (bun-types was already present).

- Implement paginate() utility in shared (was a throwing stub)
- Fix auth middleware HTTP method case sensitivity (post -> POST)
- Align User field name to canonical 'username' across packages
- Add missing badRequest import in users route
- Add bun-types to tsconfig for clean tsc --noEmit
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