Skip to content

fix: resolve failing tests across api and shared packages#24

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/job-e2e-tier2-2425-1779640230
Open

fix: resolve failing tests across api and shared packages#24
stooit wants to merge 1 commit into
mainfrom
quantcode/job-e2e-tier2-2425-1779640230

Conversation

@stooit
Copy link
Copy Markdown
Contributor

@stooit stooit commented May 24, 2026

Summary

  • Auth middleware: Fixed case-sensitivity bug in HTTP method comparison — publicMethods used lowercase "post" but Hono passes uppercase "POST"
  • Shared types: Renamed userName field to username in the User type to match usage across all tests and route handlers
  • Users route: Added missing badRequest helper function (returns 400 JSON response) that was referenced but undefined
  • Pagination utility: Implemented the paginate function to slice arrays and return { data, page, pageSize, total, totalPages } as expected by the test suite

Verification

All 22 tests pass (bun test). TypeScript compilation (npx tsc --noEmit) is clean for source files — remaining errors are only in test files due to missing @types/bun declarations (expected in this setup; tests run correctly via Bun runtime).

Assumptions

  • The bun:test and process type errors in test files are acceptable since they only affect IDE/tsc checks, not runtime behavior
  • The pagination utility returns 1-indexed pages based on test expectations
  • The badRequest helper was inlined in the users route rather than imported from an external module

- Fix auth middleware case-sensitivity bug (HTTP methods comparison)
- Fix User type field name (userName → username) for consistency
- Add missing badRequest helper in users route
- Implement pagination utility to satisfy test expectations
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