fix: repair failing tests and type errors across api and shared packages#81
Open
stooit wants to merge 1 commit into
Open
fix: repair failing tests and type errors across api and shared packages#81stooit wants to merge 1 commit into
stooit wants to merge 1 commit into
Conversation
- Implement paginate() utility (was an unimplemented stub)
- Fix auth middleware case-sensitivity bug ("post" -> "POST") that
incorrectly rejected public POST /users requests
- Add missing badRequest import / usage in users route handler
- Align shared User type field userName -> username to match tests
and route handler
- Wire bun-types into tsconfig so bun globals resolve under tsc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes all failing tests and type errors in the multi-package repo.
bun testis now 22/22 green andbunx tsc --noEmitreports zero errors.Changes
packages/shared/src/utils/pagination.ts— implementedpaginate()(was athrow new Error("not implemented")stub). Handles empty arrays, out-of-range pages, and partial last pages; returnsdata,page,pageSize,total,totalPages.packages/api/src/middleware/auth.ts— fixed a case-sensitivity bug where the public-methods list contained"post"(lowercase). Hono'sc.req.methodis always uppercase, soPOST /userswas incorrectly treated as requiring a token. Changed to"POST". Also resolved theprocesstype error via tsconfig wiring.packages/api/src/routes/users.ts— added the missingbadRequestimport that caused a runtime failure on the 400-for-missing-fields path; updated field usage tousername.packages/shared/src/types.ts— renamedUser.userName→usernameto match both the tests and the route handler (the type was the outlier causing the cross-package inconsistency).tsconfig.json— wired in the already-installedbun-typessobun:testand Bun globals resolve undertsc(no new dependencies added).Verification
bun test→ 22 pass, 0 failbunx tsc --noEmit→ exit 0, no errorsAssumptions
usernamebecause the test files — which must not be modified — useusername.pageinput topaginate()is out of scope (not reachable via any route, not exercised by tests).