fix: repair failing tests and type errors across api and shared packages#93
Open
stooit wants to merge 1 commit into
Open
fix: repair failing tests and type errors across api and shared packages#93stooit wants to merge 1 commit into
stooit wants to merge 1 commit into
Conversation
- implement paginate() stub in shared/utils with correct edge-case handling
- rename User.userName -> username for consistency with route handlers and tests
- fix auth middleware public-method allow-list casing ('post' -> 'POST')
- add missing badRequest import in users route handler
- wire compiler types into tsconfig to resolve bun:test and process
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 TypeScript errors across the
apiandsharedpackages. Final state: 22 tests pass, 0 fail;tsc --noEmitclean.Changes
shared/src/utils/pagination.ts— implemented thepaginate()stub (previously threw "not implemented"). Handles 1-indexed page slicing,total,totalPagesrounding, out-of-range pages (→ emptydata), and empty input.shared/src/types.ts— renamedUser.userName→usernameto align the shared type with the route handlers and the (unmodifiable) test contracts.api/src/middleware/auth.ts— fixed a case-sensitivity bug in the public-method allow-list soPOST /usersis correctly treated as public (no token required); also resolved theCannot find name 'process'type error.api/src/routes/users.ts— added the missingbadRequestimport causing the "returns 400 for missing fields" handler to fail at runtime.tsconfig.json— wired compilertypessobun:testandprocessresolve (no new dependencies added).Verification
bun test→ 22 pass / 0 failbunx tsc --noEmit→ exit 0usernamerename confirmed consistent across both packages.Assumptions
username, notuserName).🤖 Generated with QuantCode Agent