Skip to content

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

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier2-2385-1781562909
Open

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

Conversation

@stooit

@stooit stooit commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all failing tests (now 22 pass / 0 fail) and eliminates all tsc --noEmit type errors across the api and shared packages. Bugs spanned both packages as expected.

Changes

  • packages/shared/src/utils/pagination.ts — Implemented the paginate() stub. Handles last partial page, out-of-range pages, empty arrays, and guards against division-by-zero for a zero size.
  • packages/api/src/middleware/auth.ts — Fixed a case-sensitivity bug: the public-methods allow-list contained lowercase "post", which never matched Hono's uppercase c.req.method, so POST requests wrongly required a token. Changed to "POST".
  • packages/shared/src/types.ts — Renamed the User field userNameusername to be consistent with the route handlers and tests.
  • packages/api/src/routes/users.ts — Fixed a missing badRequest import and the username field reference.
  • tsconfig.json — Added "types": ["bun-types"] to compilerOptions so bun:test imports and process resolve. bun-types was already an installed devDependency — no new dependencies added.

Verification

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

Constraints honoured

  • No test files modified
  • No new dependencies added
  • Changes scoped to only what the tests require

Assumptions

  • bun-types was already present as a devDependency; the type-resolution failures were a tsconfig wiring issue, not a missing package, so the fix was a config directive rather than an install.
  • The "correct" field name is username (matching the tests and route handlers), so the shared type was aligned to that rather than changing consumers.

…ages

- Implement paginate() utility with correct edge-case handling
- Fix auth middleware case-sensitivity bug (lowercase "post" in public methods allow-list)
- Add bun-types to tsconfig compilerOptions so bun:test and process resolve
- Fix missing badRequest import and username field-name mismatch in users route
- Align User.username field name between packages
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