Skip to content

fix: repair failing tests and type errors across api and shared packages#57

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier2-2500-1781569624
Open

fix: repair failing tests and type errors across api and shared packages#57
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier2-2500-1781569624

Conversation

@stooit

@stooit stooit commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all failing tests and TypeScript type errors. Final state: 22 pass / 0 fail, tsc --noEmit exits clean.

Changes

File Fix
packages/api/src/middleware/auth.ts Corrected "post""POST" in the public-methods allow-list. Hono's c.req.method is always uppercase, so the lowercase entry never matched and POST /users was wrongly treated as auth-required.
packages/api/src/routes/users.ts Added the missing badRequest import (was TS2552: Cannot find name 'badRequest'); aligned field to username.
packages/shared/src/types.ts Aligned User field userNameusername for cross-package consistency.
packages/shared/src/utils/pagination.ts Implemented the paginate() stub: page slicing, totalPages via Math.ceil, out-of-range / empty-array edge cases.
tsconfig.json Added @e2e/shared path alias + wired up types so cross-package imports and Node globals (process) type-check.

Verification

  • bun test → 22 pass, 0 fail (4 files)
  • npx tsc --noEmit → exit 0, no errors
  • Independent code review: approved; all paginate() edge cases confirmed sound; rename confirmed consistent with no orphaned references.

Assumptions

  • username (not userName) is canonical, since the unmodifiable test files use username.
  • @types/node was already present; only tsconfig wiring was needed (no new dependencies).

Constraints honoured

No test files modified, no new dependencies added.

- auth middleware: correct "post" -> "POST" in public-methods allow-list
  (Hono method strings are uppercase; lowercase never matched)
- users route: import missing badRequest helper
- shared types: align User field userName -> username to match contract
- pagination: implement paginate() stub (slice, totalPages, edge cases)
- tsconfig: add @e2e/shared path alias and wire up types
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