Skip to content

fix: resolve all test failures and type errors across api and shared packages#36

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier2-2390-1780245338
Open

fix: resolve all test failures and type errors across api and shared packages#36
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier2-2390-1780245338

Conversation

@stooit
Copy link
Copy Markdown
Contributor

@stooit stooit commented May 31, 2026

Summary

  • Auth middleware: Fixed case-sensitivity bug where HTTP method comparison used lowercase ("post") but Hono passes uppercase ("POST"), causing public routes to incorrectly return 401
  • Users route: Added missing badRequest import and fixed field name from username to match the User type definition
  • Shared types: Aligned the User type field name (nameusername) to match what both tests and route handlers expect
  • Pagination utility: Implemented the paginate<T>() function with proper 1-indexed page slicing, returning { data, page, pageSize, total, totalPages }
  • TypeScript config: Added bun-types to resolve process.env typing error in auth middleware

Verification

All 22 tests pass across 4 test files with 37 assertions. Zero TypeScript type errors (tsc --noEmit clean).

Assumptions

  • The User type's field should be username (not name) since both tests and route handlers use that name
  • Pagination is 1-indexed (page 1 = first page) based on test expectations
  • Out-of-range pages return empty data arrays with correct metadata

…packages

- Fix auth middleware case-sensitivity bug (compare HTTP methods in uppercase)
- Add missing badRequest import in users route handler
- Fix field name inconsistency in User type (name -> username)
- Implement paginate utility function with proper page slicing
- Add bun-types to tsconfig for process.env typing
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