Skip to content

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

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier2-2530-1782752971
Open

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

Conversation

@stooit

@stooit stooit commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all failing tests and TypeScript type errors in the Bun + Hono monorepo. 22/22 tests pass and tsc --noEmit exits cleanly.

Fixes (5 files, source + tsconfig only)

File Fix
packages/shared/src/utils/pagination.ts Implemented paginate<T> (was a stub throwing not implemented). 1-indexed page slicing via (page-1)*size, totalPages = Math.ceil(total/size), graceful empty-array and out-of-range handling.
packages/api/src/middleware/auth.ts Case-sensitivity bug: public-method check used "post" but Hono c.req.method is uppercase, so every POST wrongly required a token. Changed to "POST".
packages/shared/src/types.ts User field userNameusername for consistency with route handlers and tests.
packages/api/src/routes/users.ts Added missing badRequest import (was a runtime ReferenceError on invalid POST /users bodies).
tsconfig.json Wired the already-installed bun-types into compilerOptions.types so bun:test/process resolve. strict preserved.

Verification

  • bun test → 22 pass, 0 fail
  • bunx tsc --noEmit → exit 0, no errors
  • Independently re-run after fixes; reviewed by the review agent (verdict: approve).

Constraints honoured

  • No test files modified.
  • No new dependencies added (bun-types was already installed; only tsconfig wiring changed).
  • Only the code required by the failing tests was changed.

Assumptions

  • The canonical User field name is username (chosen to match the tests, which cannot be modified).

…ages

- Implement paginate<T> in shared (was a stub throwing 'not implemented')
- Fix auth middleware public-method check: 'post' -> 'POST' (HTTP methods are uppercase), so POST /users is correctly public
- Align User type field 'userName' -> 'username' for cross-package consistency
- Add missing badRequest import in users route handler
- Wire already-installed bun-types into tsconfig so bun:test/process resolve
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