Skip to content

fix: resolve failing tests across api and shared packages#42

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier2-2442-1780880111
Open

fix: resolve failing tests across api and shared packages#42
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier2-2442-1780880111

Conversation

@stooit

@stooit stooit commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all failing tests and the code-level type errors in the monorepo. 22/22 tests pass. No test files modified, no dependencies added.

Fixes

  • api/src/routes/users.tsbadRequest was called but never imported, causing a ReferenceError (500 instead of 400 on missing fields). Added the missing import.
  • api/src/middleware/auth.ts — public-methods list contained lowercase "post", which never matched Hono's uppercase c.req.method, so POST /users wrongly required a token (401 instead of 201). Corrected to "POST".
  • shared/src/utils/pagination.ts — implemented the paginate<T>() stub: correct page slicing, partial last page, total/totalPages, page/pageSize fields, and empty/out-of-range handling.
  • shared/src/types.ts — reconciled inconsistent field name across the shared and api packages.

Verification

  • bun test22 pass / 0 fail.
  • tsc --noEmit: errors reduced from 33 (on main) → 8. The remaining 8 are pre-existing environment-config issues (bun:test module and process global untyped — no bun-types/@types/node in compilerOptions.types). Resolving them would require adding dependencies, which the task explicitly forbids. None relate to the failing tests.

Assumptions

  • "Fix only what the tests require" + "do not add dependencies" → the pre-existing untyped-process/bun:test tsc errors were left as-is.
  • Independent verification confirmed all 8 remaining tsc errors also exist on main (33 baseline errors), so none were introduced by this change.

Review

Independently reviewed (review subagent): APPROVE — auth fix introduces no bypass risk, pagination edge cases correct, type reconciliation consistent across packages.

- import badRequest in users route (was ReferenceError -> 500 on bad input)
- fix auth middleware method case-sensitivity ('post' -> 'POST') so POST is public
- implement paginate() utility with correct edge-case handling
- reconcile shared User type field name (userName -> username) across packages
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