fix: resolve failing tests and type errors across api and shared packages#72
Open
stooit wants to merge 1 commit into
Open
fix: resolve failing tests and type errors across api and shared packages#72stooit wants to merge 1 commit into
stooit wants to merge 1 commit into
Conversation
…ages
- Implement paginate() in shared (was a not-implemented stub)
- Fix auth middleware public-methods list ("post" -> "POST") so POST is
matched per RFC 7231 uppercase HTTP methods
- Rename User.userName -> username for consistency with api routes and tests
- Add missing badRequest import in users route
- Register already-installed bun-types in tsconfig to resolve bun:test and
process globals (no new dependency)
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 9 failing tests and eliminates all
tsc --noEmittype errors. Final state: 22 pass / 0 fail, tsc clean.Changes
shared/src/utils/pagination.ts— Implementedpaginate()(was athrow "not implemented"stub). Correct page slicing,total/totalPages, out-of-range pages return emptydata, empty-array handled.api/src/middleware/auth.ts— Fixed HTTP-method case-sensitivity bug so the public-route method (POST) is matched correctly (HTTP methods are uppercase per RFC 7231).POST /usersis now correctly treated as public.shared/src/types.ts— RenamedUser.userName→usernameto be consistent with the api routes and the (unmodifiable) tests, which useusername.api/src/routes/users.ts— Added the missingbadRequestimport; aligned tousername.tsconfig.json— Added the already-installedbun-typesdevDependency tocompilerOptions.typessobun:testandprocessglobals resolve. No new dependency added;strictunchanged.Verification
bun test→ 22 pass, 0 failbunx tsc --noEmit→ no errorsAssumptions
Userfield was renamed tousernameto match them.bun-typeswas already an installed devDependency, so referencing it intsconfig(rather than installing@types/node) is the minimal, dependency-free way to resolve theprocess/bun:testtype errors.Constraints honoured