fix: resolve failing tests and type errors across api and shared packages#40
Open
stooit wants to merge 1 commit into
Open
fix: resolve failing tests and type errors across api and shared packages#40stooit wants to merge 1 commit into
stooit wants to merge 1 commit into
Conversation
…ages - routes/users: import missing badRequest helper (was throwing ReferenceError → 500) - middleware/auth: use uppercase HTTP methods in public allow-list so POST /users is public - shared/types: rename User.userName → username to match callers and tests - shared/pagination: implement paginate() (1-indexed, real slice + totalPages) - tsconfig: add types:[bun-types] so bun:test globals and process resolve
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. After this change: 22 tests pass, 0 fail and
tsc --noEmitis clean.Fixes
api/src/routes/users.tsbadRequestcalled but not imported →ReferenceError(500 instead of 400)badRequestto the../lib/errorsimportapi/src/middleware/auth.ts"post") butc.req.methodis uppercase, soPOST /userswrongly returned 401"GET","POST")shared/src/types.tsUser.userNamemismatched theusernamefield used by routes and testsuserName→username(canonical, per authoritative tests)shared/src/utils/pagination.tspaginate()was a throwing stubtotal/totalPages/page/pageSize, handles partial last page, out-of-range, and empty inputtsconfig.jsonbun:testmodule andprocessunresolvedAlso removed two now-stale code comments (the `// BUG:` note and the pagination `TODO`).
Verification
Constraints honoured
Assumptions