Skip to content

fix: make test suite pass and eliminate type errors#59

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier2-2446-1781589095
Open

fix: make test suite pass and eliminate type errors#59
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier2-2446-1781589095

Conversation

@stooit

@stooit stooit commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all failing tests (now 22 pass / 0 fail) and eliminates all tsc --noEmit type errors across the api and shared packages.

Changes

  • Pagination (packages/shared/src/utils/pagination.ts): implemented the paginate<T> stub — page slice, total, totalPages, page/pageSize; handles partial last pages, out-of-range pages, and empty arrays.
  • Shared type consistency (packages/shared/src/types.ts): renamed User field userNameusername to match every consumer (db, route, tests).
  • Auth middleware (packages/api/src/middleware/auth.ts): fixed a case-sensitivity bug — the public-method allow-list checked "post" against Hono's uppercase c.req.method, so POST /users was wrongly treated as protected.
  • Users route (packages/api/src/routes/users.ts): added the missing badRequest import that broke the missing-fields validation path.
  • tsconfig: added bun-types to compilerOptions.types to resolve process / bun:test global type errors (no new dependencies).

Verification

  • bun test → 22 pass, 0 fail
  • npx tsc --noEmit → clean

Assumptions / notes

  • Followed "fix only what tests require; do not modify tests; no new dependencies". Tests were authoritative for the username spelling.
  • Review flagged a non-blocking edge case: paginate does not guard degenerate inputs (size<=0/page<=0). Not exercised by the suite; adding a throw/clamp would introduce unspecified behaviour, so left out per the mandate. Worth a follow-up if pagination query params get exposed without validation.

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