Skip to content

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

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier2-2523-1783357659
Open

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

Conversation

@stooit

@stooit stooit commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all 9 failing tests and all tsc --noEmit type errors. Final state: 22 tests pass, 0 fail, 0 type errors.

Changes

File Fix
packages/api/src/middleware/auth.ts HTTP method case bug — public-methods allow-list had lowercase 'post'; methods arrive uppercase per RFC 7231, so POST /users was not treated as public. Changed to 'POST'.
packages/shared/src/types.ts Renamed User.userNameusername to match what route code and tests use (field-name inconsistency between packages).
packages/api/src/routes/users.ts Added missing badRequest import from ../lib/errors (was a runtime ReferenceError).
packages/shared/src/utils/pagination.ts Implemented the paginate() stub per the test contract (slice, total, totalPages, page, pageSize).
tsconfig.json Added "types": ["bun-types"] to resolve process / bun:test type errors. bun-types ships with Bun — no new dependency.

Assumptions

  • Tests are the source of truth: canonical field name is username, so source conformed to tests.
  • bun-types was already available via the Bun runtime; referencing it in tsconfig is config, not a new dependency.

Verification

  • bun test → 22 pass / 0 fail
  • npx tsc --noEmit → exit 0

Constraints honoured

No test files modified. No new dependencies added. Minimal, targeted fixes only.

…ages

- auth middleware: fix HTTP method case-sensitivity ('post' -> 'POST')
- shared types: rename User.userName -> username for cross-package consistency
- users route: add missing badRequest import from ../lib/errors
- shared pagination: implement paginate() per test contract
- tsconfig: reference bun-types to resolve process/bun:test type errors
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