fix: repair failing tests and type errors across api and shared packages#88
Open
stooit wants to merge 1 commit into
Open
fix: repair failing tests and type errors across api and shared packages#88stooit wants to merge 1 commit into
stooit wants to merge 1 commit into
Conversation
- Implement paginate() utility in shared (was a throwing stub) - Fix auth middleware HTTP method case sensitivity (post -> POST) - Align User field name to canonical 'username' across packages - Add missing badRequest import in users route - Add bun-types to tsconfig for clean tsc --noEmit
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 eliminates all
tsc --noEmittype errors.bun testnow reports 22 pass / 0 fail andtsc --noEmitexits clean.Root causes fixed
paginate<T>()inpackages/shared/src/utils/pagination.tswas a stub that threwnot implemented. Implemented per the test contract — correct page slice, second/partial-last page,total/totalPages/page/pageSizefields, empty-array and out-of-range-page handling.packages/api/src/middleware/auth.tscompared the HTTP method against lowercase"post", soPOST /userswas not treated as public. Fixed to uppercase"POST"to matchc.req.method.Usertype useduserNamewhile routes and tests usedusername. Aligned the shared type to the canonicalusername.packages/api/src/routes/users.tsreferencedbadRequestwithout importing it. Added the import."types": ["bun-types"]totsconfig.jsonsobun:testimports and Bun/Node globals (e.g.process) resolve undertsc --noEmit.Verification
bun test-> 22 pass, 0 failtsc --noEmit-> clean (exit 0)Assumptions
username(lowercase) is the canonical field name — determined by reading the unmodified test files.bun-typeswas already present).