Skip to content

fix: repair failing tests and type errors across api and shared - #110

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier2-2473-1785110079
Open

fix: repair failing tests and type errors across api and shared#110
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier2-2473-1785110079

Conversation

@stooit

@stooit stooit commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all 9 failing tests and 14 tsc --noEmit errors in the api/shared multi-package repo. Baseline was 9 fail / 14 type errors → now 22 pass / 0 fail and tsc clean.

Fixes

  • Pagination (shared): implemented paginate() (was a not implemented stub) — page slicing, total, totalPages, page/pageSize, empty/out-of-range handling. Also guards non-finite page/size with Number.isFinite (prevents NaNnull serialization and an Infinity-driven unbounded-response path).
  • Shared types: reconciled the User field name to username consistently across both packages (tests expected the shared type's name; source now matches).
  • Route handler (api): added the missing badRequest import in routes/users.ts — fixes POST /users 400-on-missing-fields.
  • Auth middleware (api): fixed a case-sensitive HTTP-method comparison so public routes (e.g. POST /users) are recognized regardless of method casing.
  • tsconfig: referenced already-installed bun types so process / bun:test resolve. No new dependencies added.

Verification

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

Assumptions

  • Where tests and source disagreed on the field name, source was changed to match the tests / shared User type (per instructions not to modify tests).
  • tsconfig types were wired to packages already present in node_modules; nothing was installed.

Notes

  • No test files modified; no dependencies added.

- Implement paginate() in shared (was a stub); guard non-finite page/size
- Reconcile User field name to `username` across api and shared
- Add missing badRequest import in users route (fixes 400 handler)
- Fix case-sensitive HTTP method check in auth middleware public routes
- Wire up bun-types in tsconfig so process/bun:test resolve

All 22 tests pass; tsc --noEmit is clean.
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