Skip to content

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

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier2-2488-1780881821
Open

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

Conversation

@stooit

@stooit stooit commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all failing tests (now 22/22 pass) and eliminates all tsc --noEmit type errors across the api and shared packages. Changes are minimal and confined to source/config — no test files modified, no dependencies added.

Changes

  • packages/shared/src/utils/pagination.ts — Implemented the paginate() utility (was a throwing stub). Handles empty input, out-of-range pages, partial last pages, and computes total/totalPages/page/pageSize correctly.
  • packages/api/src/middleware/auth.ts — Fixed a case-sensitivity bug in the HTTP method comparison so POST /users is correctly treated as a public route. Also resolved the process type error.
  • packages/api/src/routes/users.ts — Added the missing badRequest import that caused a runtime failure on the missing-fields path.
  • packages/shared/src/types.ts — Renamed User.userNameusername to resolve a field-name inconsistency between the shared type and its consumers/tests.
  • tsconfig.json — Added bun-types to the types array (already an installed devDependency — not a new dependency).

Verification

  • bun test22 pass, 0 fail
  • npx tsc --noEmitexit 0, no errors
  • Independent code review confirmed correctness, consumer consistency of the rename, and that no test files or dependencies were touched.

Assumptions

  • The test files are the source of truth for the canonical username field name; the shared type (userName) was the inconsistent side and was aligned to the tests rather than editing tests.
  • bun-types was treated as a config fix (existing devDependency) rather than a new dependency.

…ages

- Implement paginate() utility in shared package (was a throwing stub)
- Fix auth middleware case-sensitivity bug ("post" -> "POST") so POST /users is public
- Add missing badRequest import in users route handler
- Rename User.userName -> username in shared types for cross-package consistency
- Add bun-types to tsconfig types (already an installed devDependency)
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