Skip to content

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

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier2-2450-1781546468
Open

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

Conversation

@stooit

@stooit stooit commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all failing tests and TypeScript type errors in the monorepo. Final state: 22 tests pass, 0 fail; tsc --noEmit clean (exit 0). No test files were modified; no dependencies added.

Changes

  • Auth middleware (packages/api/src/middleware/auth.ts) — fixed an HTTP-method case-sensitivity bug: the public-method allow-list contained lowercase "post", so legitimate POST /users requests fell through to auth and returned 401. Now "POST".
  • Users route (packages/api/src/routes/users.ts) — added the missing badRequest response-helper import that was causing a failure; aligned the create payload on the username field.
  • Shared types (packages/shared/src/types.ts) — renamed the User field userNameusername so the type matches what the tests (the source of truth) use. Removed a stale BUG: comment.
  • Pagination utility (packages/shared/src/utils/pagination.ts) — implemented the previously-stubbed utility to satisfy its test.
  • tsconfig.json — added bun-types to compilerOptions.types so process and bun:test resolve at type-check time without adding any dependency.

Verification

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

Assumptions

  • When a test and a type disagreed on a field name (username vs userName), the test was treated as authoritative since test files must not be modified — so the shared User type was changed to username.
  • bun-types is already available in the workspace; it was added to tsconfig types rather than installed as a new dependency.

…ages

- Fix auth middleware HTTP method case-sensitivity (post -> POST) causing 401 on POST /users
- Add missing badRequest import in users route
- Align shared User type field on 'username' (was 'userName') to match tests
- Implement pagination utility in shared package
- Configure tsconfig bun-types so process/bun:test resolve without new deps
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