Skip to content

fix: resolve all failing tests and type errors#67

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier2-2462-1782060170
Open

fix: resolve all failing tests and type errors#67
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier2-2462-1782060170

Conversation

@stooit

@stooit stooit commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all failing tests and eliminates all type errors across the api and shared packages. Final state: 22 pass / 0 fail, tsc --noEmit clean.

Changes

  • auth middleware (packages/api/src/middleware/auth.ts): fixed a case-sensitivity bug where the public-methods check used "post" while Hono reports HTTP methods uppercased — POST /users is now correctly treated as public (no token required). Also switched process.env.API_TOKEN to Bun.env.API_TOKEN since @types/node is not in scope.
  • users route (packages/api/src/routes/users.ts): added the missing badRequest import (runtime failure) and aligned the response field name to the canonical userName.
  • shared types (packages/shared/src/types.ts): aligned the User field name to userName to resolve the cross-package inconsistency the tests expect.
  • pagination (packages/shared/src/utils/pagination.ts): implemented the previously-stubbed paginate() to satisfy the full test contract (page slicing, totals/totalPages, page/pageSize, out-of-range and empty-array handling).
  • tsconfig (tsconfig.json): added a bun-types reference so test files resolve bun:test and Bun env typings — no new dependencies added.

Assumptions

  • Canonical field name is userName, taken from what the (unmodified) test files reference; source was aligned to the tests rather than vice versa.
  • The bun:test / process type errors in test files were a tsconfig types-resolution gap, fixed via config only — no test files were modified and no dependencies added.

Verification

  • bun test → 22 pass, 0 fail
  • bunx tsc --noEmit → no errors

🤖 Generated autonomously.

…ages

- auth middleware: fix case-sensitivity bug in public HTTP methods (post -> POST)
  and use Bun.env instead of process.env (no @types/node in scope)
- users route: add missing badRequest import and align field name to canonical userName
- shared types: align User field name to userName for cross-package consistency
- pagination: implement paginate() stub to satisfy the full test contract
- tsconfig: add bun-types reference so test files resolve bun:test and env
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