Skip to content

fix: resolve failing tests and type errors across api and shared packages#41

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier2-2384-1780877983
Open

fix: resolve failing tests and type errors across api and shared packages#41
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier2-2384-1780877983

Conversation

@stooit

@stooit stooit commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all failing tests and type errors in the multi-package TypeScript HTTP API repo. Final state: 22 tests pass, 0 fail; tsc --noEmit clean.

Changes

  • Pagination utility (packages/shared/src/utils/pagination.ts): implemented the previously stubbed paginate() (page slicing, total, totalPages, page, pageSize, empty/out-of-range handling) to satisfy the test contract.
  • Auth middleware (packages/api/src/middleware/auth.ts): fixed an HTTP-method case-sensitivity bug that caused POST /users not to be treated as a public route; resolved the process type error via tsconfig types.
  • Users route (packages/api/src/routes/users.ts): added the missing badRequest import causing a runtime failure for the missing-fields case.
  • Shared types (packages/shared/src/types.ts): aligned the User field name to username to match the contract used across both packages and the tests.
  • tsconfig.json: configured node/bun types to eliminate Cannot find name 'process' and Cannot find module 'bun:test' errors.

Verification

  • bun test → 22 pass / 0 fail
  • npx tsc --noEmit → exit 0

Assumptions

  • The canonical field name is username (not userName) because the unmodifiable test files reference username; the shared type and source usages were aligned to the tests, which are the contract.
  • Type-resolution issues were fixed via tsconfig (using already-available type packages); no new dependencies were added and no test files were modified.

…ages

- Implement paginate() utility (was an unimplemented stub)
- Fix auth middleware HTTP method case-sensitivity for public routes
- Add missing badRequest import in users route handler
- Align shared User type field name (userName -> username) to match contract
- Configure node/bun types in tsconfig to resolve type errors
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