Skip to content

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

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier2-2458-1781198726
Open

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

Conversation

@stooit

@stooit stooit commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Summary

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

Changes

  • Auth middleware (packages/api/src/middleware/auth.ts): replaced a case-sensitive lowercase string comparison with an uppercase HTTP-method allow-list checked against c.req.method (which Hono normalises to uppercase). POST /users is now correctly treated as a public route.
  • Shared types (packages/shared/src/types.ts): canonicalised the User field name to username, matching what the tests and API routes expect, resolving the cross-package inconsistency.
  • Pagination utility (packages/shared/src/utils/pagination.ts): implemented the previously-stubbed paginate<T>(items, page, size) with correct page-slice, partial-last-page, out-of-range, empty-input, and totalPages handling per the test contract.
  • Route handlers (packages/api/src/routes/users.ts): added the missing badRequest import and aligned the field name.

Verification

  • bun test -> 22 pass, 0 fail
  • npx tsc --noEmit -> clean (exit 0)
  • Independent review pass: approved, no blocking issues.

Assumptions

  • Canonical User field name is username (the form the tests assert against).
  • No test files were modified and no new dependencies were added, per task constraints.

Notes

  • A reviewer flagged one pre-existing, non-blocking edge case (no change required for the tests to pass); left untouched to keep the fix scoped to what the tests require.

…te imports

- auth middleware: use uppercase HTTP method allow-list so POST /users is correctly treated as public
- shared types: canonicalise User field to 'username' across both packages
- pagination: implement paginate<T>() with correct slice/totalPages edge-case handling
- routes/users: add missing badRequest import and align field name
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