fix: repair failing tests and type errors across api and shared packages#62
Open
stooit wants to merge 1 commit into
Open
fix: repair failing tests and type errors across api and shared packages#62stooit wants to merge 1 commit into
stooit wants to merge 1 commit into
Conversation
- implement paginate<T> stub in shared/utils/pagination.ts - fix case-sensitivity bug in auth middleware public-route allow-list - align shared User type field (userName) with source usage - add missing badRequest import in routes/users.ts - wire bun-types into tsconfig so bun:test 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 TypeScript errors. Final state: 22/22 tests pass,
tsc --noEmitclean.Bugs fixed
shared/src/utils/pagination.ts) — implemented thepaginate<T>stub (page slice,total,totalPages,page/pageSize, out-of-range → empty data, empty-array handling) per the test contract.api/src/middleware/auth.ts) — fixed a case-sensitivity bug in the public-route method allow-list soPOST /usersis correctly treated as public (HTTP methods are uppercase per RFC 7231).shared/src/types.ts) — aligned theUserfield name (userName) so source matches what the tests expect.api/src/routes/users.ts) — added the missingbadRequestimport causing the 400-for-missing-fields handler to fail at runtime.tsconfig.json) — addedlib/types: ["bun-types"]sobun:testandprocessresolve. No new dependencies installed (bun-typeswas already present).Constraints honoured
Assumptions / notes
paginatefollows the tested contract; a defensive guard forpage <= 0was noted in review but is outside the tested contract and left unchanged to avoid scope creep.Verification
bun test→ 22 pass, 0 failnpx tsc --noEmit→ no errors