Skip to content

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

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier2-4684-1783010534
Open

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

Conversation

@stooit

@stooit stooit commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all failing tests and TypeScript errors across the api and shared packages. Final state: 22/22 tests pass and tsc --noEmit is clean.

Changes

  • Pagination (packages/shared/src/utils/pagination.ts) — implemented the paginate<T>() utility, which was a throwing stub. Computes total and totalPages, slices by (page-1)*size, and returns empty data for out-of-range pages.
  • Auth middleware (packages/api/src/middleware/auth.ts) — fixed an HTTP-method case-sensitivity bug so POST /users is correctly treated as a public (no-token) route.
  • User field naming (packages/shared/src/types.ts, packages/api/src/routes/users.ts) — aligned the User type field name with the spelling the tests expect, resolving cross-package type mismatches, and imported the missing badRequest response helper in the users route.
  • tsconfig.json — included the already-installed node/bun type definitions to resolve process / bun:test type-resolution errors. No new dependencies were added.

Verification

  • bun test → 22 pass, 0 fail
  • npx tsc --noEmit → clean (exit 0)

Constraints honoured

  • No test files modified
  • No new dependencies added
  • Fixed only what the tests required

Assumptions

  • The test files are the source of truth for the canonical User field name; source types and route handlers were aligned to match them.
  • The required node/bun type packages were already present in node_modules, so they were referenced via tsconfig rather than installed.

- Implement paginate() utility in shared package (was a throwing stub)
- Fix case-sensitivity bug in auth middleware so POST /users is public
- Align User type field naming with tests; import badRequest helper in users route
- Include node/bun types in tsconfig to resolve type-resolution 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