Skip to content

fix: make all tests pass and eliminate type errors - #196

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier2-2178-1790225189
Open

stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier2-2178-1790225189

Conversation

@stooit

@stooit stooit commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

Summary

  • auth middleware (packages/api/src/middleware/auth.ts): public-method allow-list had "post"; c.req.method is uppercase so POST was rejected with 401. Changed to "POST".
  • shared types (packages/shared/src/types.ts): userName → username to match db, routes, and tests (fixed 6 type errors).
  • pagination (packages/shared/src/utils/pagination.ts): implemented the paginate stub (1-indexed pages, totalPages = ceil(total/size), empty slice for out-of-range pages).
  • users route (packages/api/src/routes/users.ts): added missing badRequest import (was causing a 500 instead of 400).
  • tsconfig.json: added "types": ["bun-types"] — already a devDependency, just not wired in (fixed bun:test/process type errors).

Verification

  • bun test: 22 pass / 0 fail
  • node_modules/.bin/tsc --noEmit: clean (tsc is not on global PATH)

Assumptions / notes

  • Test files not modified; no dependencies added.
  • POST being public (unauthenticated writes) is kept on purpose. The docs and auth.test.ts both require it. Whether that policy is right for production is a separate question for the API owner.
  • paginate clamps page/size to >= 1. Non-numeric input (NaN) is not handled because no test covers it.
  • requireFields middleware in validate.ts is never used. Left as is because it's outside the scope of this fix.

…nd missing import

Implement paginate per its contract, align User.username across packages,
fix POST never matching the public-method allow-list, add missing badRequest
import, and wire existing bun-types into tsconfig.
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