Skip to content

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

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier2-2355-1781888127
Open

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

Conversation

@stooit

@stooit stooit commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all failing tests and type errors in the multi-package TypeScript HTTP API. After the change, bun test reports 22 pass / 0 fail and tsc --noEmit exits clean with zero errors.

Changes

  • packages/shared/src/utils/pagination.ts — implemented the paginate<T>() stub: 1-indexed page slicing, total from items.length, totalPages via Math.ceil(total / pageSize), correct page/pageSize fields. Handles partial last pages, out-of-range pages, and empty arrays.
  • packages/api/src/middleware/auth.ts — fixed a case-sensitivity bug: public-method matching used lowercase while Hono normalises c.req.method to uppercase, so the intentionally public POST /users was treated as protected. Protected methods (e.g. DELETE) remain protected.
  • packages/shared/src/types.ts + packages/api/src/routes/users.ts — reconciled the inconsistent User field name to username, matching the route handler and test assertions.
  • packages/api/src/routes/users.ts — added the missing badRequest import.
  • tsconfig.json — added bun-types to compilerOptions.types so tsc recognises Bun globals, eliminating spurious type errors without adding any dependency.

Verification

  • bun test → 22 pass, 0 fail
  • npx tsc --noEmit → exit 0, no errors

Assumptions / constraints honoured

  • No test files modified.
  • No new dependencies added (bun-types was already present; only referenced via tsconfig).
  • Changes are minimal and targeted to what the tests/typecheck require.
  • username (lowercase) chosen because the test suite asserts that field.
  • Public POST confirmed intentional by the test suite.

🤖 Generated with QuantCode autonomous agent

- implement paginate() stub in shared (slice, total, totalPages)
- fix auth middleware case-sensitivity for public POST method
- reconcile User.username field name between packages
- add missing badRequest import in users route
- add bun-types to tsconfig types for clean tsc --noEmit
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