Skip to content

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

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier2-2467-1781111826
Open

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

Conversation

@stooit

@stooit stooit commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all failing tests and TypeScript errors in the multi-package API repo. bun test now reports 22 pass / 0 fail and bunx tsc --noEmit is clean.

Bugs fixed

Area File Fix
Auth middleware case-sensitivity packages/api/src/middleware/auth.ts Public-method list had lowercase "post", so c.req.method (always uppercase POST) never matched — every POST /users was wrongly 401'd. Changed to "POST".
Cross-package field inconsistency packages/shared/src/types.ts User type used userName while route handlers and tests use username. Aligned the canonical type to username.
Missing import packages/api/src/routes/users.ts badRequest was called but not imported — runtime ReferenceError on missing-field POSTs. Added it to the existing import.
Unimplemented utility packages/shared/src/utils/pagination.ts Replaced the throw "not implemented" stub with a real paginate() (page slice, total, totalPages, empty-array and out-of-range handling).
Type resolution tsconfig.json Added explicit "types": ["bun-types"] so Bun globals/bun:test resolve. No strictness loosened.

Verification

  • bun test → 22 pass, 0 fail
  • bunx tsc --noEmit → no errors
  • Independently reviewed and approved.

Constraints honoured

  • No test files modified.
  • No new dependencies added (bun-types was already present).
  • Only changes the tests required.

…ages

- auth middleware: correct HTTP method case ('post' -> 'POST') so POST /users is public
- shared types: align User field to 'username' for cross-package consistency
- users route: import missing 'badRequest' error helper
- shared pagination: implement paginate() stub with edge-case handling
- tsconfig: add explicit bun-types for global resolution
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