Skip to content

fix: resolve all failing tests — auth, types, imports, and pagination#23

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/job-e2e-tier2-2397-1779553760
Open

fix: resolve all failing tests — auth, types, imports, and pagination#23
stooit wants to merge 1 commit into
mainfrom
quantcode/job-e2e-tier2-2397-1779553760

Conversation

@stooit
Copy link
Copy Markdown
Contributor

@stooit stooit commented May 23, 2026

Summary

  • Auth middleware (packages/api/src/middleware/auth.ts): Fixed HTTP method case-sensitivity bug — req.method returns uppercase (e.g. "POST") but the public routes list used lowercase. Normalized comparison to uppercase. Also replaced process.env with Bun-compatible env access.
  • Users route (packages/api/src/routes/users.ts): Added missing badRequest import from ../lib/errors.
  • Shared types (packages/shared/src/types.ts): Renamed userNameusername to match what route handlers and tests expect.
  • Pagination utility (packages/shared/src/utils/pagination.ts): Implemented the paginate<T>() function (was a stub throwing "not implemented"). Returns correctly sliced data with page metadata.

Verification

  • All 22 tests pass (bun test)
  • Zero type errors in source files (npx tsc --noEmit — only test files show errors due to missing @types/bun)
  • No test files were modified
  • No new dependencies added

…mismatches, and implement pagination utility

- Auth middleware: normalize HTTP method comparison to uppercase so POST/PUT/DELETE match correctly against public route definitions
- Auth middleware: replace process.env with Bun-compatible environment access
- Users route: add missing badRequest import from lib/errors
- Shared types: rename userName to username for consistency with route handlers and tests
- Pagination utility: implement paginate() function with proper page slicing and metadata
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