Skip to content

fix: resolve all failing tests across api and shared packages#9

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/job-e2e-tier2-2353-1779436246
Open

fix: resolve all failing tests across api and shared packages#9
stooit wants to merge 1 commit into
mainfrom
quantcode/job-e2e-tier2-2353-1779436246

Conversation

@stooit
Copy link
Copy Markdown
Contributor

@stooit stooit commented May 22, 2026

Summary

  • Auth middleware: Fixed case-sensitivity bug where HTTP method comparison used lowercase "post" but actual requests use uppercase "POST", causing POST requests to /users to incorrectly return 401
  • Shared types: Renamed userName field to username in the User type to match test expectations and route handler usage
  • Users route: Added missing badRequest helper (inline 400 response) and updated field references from userName to username
  • Pagination utility: Implemented the paginate function to satisfy test expectations (accepts array + page/pageSize, returns paginated slice with metadata)
  • TypeScript: Fixed process.env reference in auth middleware to compile without @types/node

Verification

All 22 tests pass (bun test). No type errors in source files (npx tsc --noEmit — only test-file errors for bun:test module remain, which are expected in Bun runtime).

Assumptions

  • The bun:test and process tsc errors in test files are acceptable since tests run in Bun which provides these globals
  • No test files were modified
  • No new dependencies were added

- Fix auth middleware case-sensitivity bug (method comparison now matches actual HTTP methods)
- Rename User type field from userName to username for consistency with tests
- Add missing badRequest import and fix field references in users route
- Implement pagination utility to satisfy test expectations
- Fix process.env reference in auth.ts to satisfy tsc without @types/node
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