Skip to content

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

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/job-e2e-tier2-2421-1780019674
Open

fix: resolve all test failures and type errors across api and shared packages#30
stooit wants to merge 1 commit into
mainfrom
quantcode/job-e2e-tier2-2421-1780019674

Conversation

@stooit
Copy link
Copy Markdown
Contributor

@stooit stooit commented May 29, 2026

Summary

  • Auth middleware: Fixed case-sensitivity bug where HTTP methods in publicMethods were lowercase ("post") but compared against uppercase values from the request — POST/PUT/DELETE requests were incorrectly returning 401
  • Shared types: Renamed userName field to username in the User type to match what route handlers and tests expect
  • Users route: Added missing badRequest helper function and fixed field name references to align with the corrected User type
  • Pagination utility: Implemented the paginate() function in packages/shared/src/utils/pagination.ts to satisfy the existing test expectations
  • Type safety: Added process type declaration in auth middleware to eliminate TS2580 error

Verification

  • All 22 tests pass (bun test)
  • No type errors in source files (npx tsc --noEmit — remaining errors are only in test files due to missing @types/bun)

Assumptions

  • The only remaining tsc errors are in test files (bun:test module and process global) which are environment-specific and cannot be fixed without adding @types/bun as a dependency
  • The API_TOKEN environment variable name was preserved as-is from the original code

…packages

- Fix auth middleware case-sensitivity bug (HTTP methods must be uppercase)
- Fix User type field name: userName -> username to match test expectations
- Add missing badRequest helper and fix field references in users route
- Implement pagination utility (paginate function) in shared package
- Add process type declaration in auth.ts to resolve TS2580
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