fix: resolve all failing tests — auth, types, imports, and pagination#23
Open
stooit wants to merge 1 commit into
Open
fix: resolve all failing tests — auth, types, imports, and pagination#23stooit wants to merge 1 commit into
stooit wants to merge 1 commit into
Conversation
…mismatches, and implement pagination utility - Auth middleware: normalize HTTP method comparison to uppercase so POST/PUT/DELETE match correctly against public route definitions - Auth middleware: replace process.env with Bun-compatible environment access - Users route: add missing badRequest import from lib/errors - Shared types: rename userName to username for consistency with route handlers and tests - Pagination utility: implement paginate() function with proper page slicing and metadata
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
packages/api/src/middleware/auth.ts): Fixed HTTP method case-sensitivity bug —req.methodreturns uppercase (e.g."POST") but the public routes list used lowercase. Normalized comparison to uppercase. Also replacedprocess.envwith Bun-compatible env access.packages/api/src/routes/users.ts): Added missingbadRequestimport from../lib/errors.packages/shared/src/types.ts): RenameduserName→usernameto match what route handlers and tests expect.packages/shared/src/utils/pagination.ts): Implemented thepaginate<T>()function (was a stub throwing "not implemented"). Returns correctly sliced data with page metadata.Verification
bun test)npx tsc --noEmit— only test files show errors due to missing@types/bun)