fix: resolve failing tests and type errors across api and shared packages#41
Open
stooit wants to merge 1 commit into
Open
fix: resolve failing tests and type errors across api and shared packages#41stooit wants to merge 1 commit into
stooit wants to merge 1 commit into
Conversation
…ages - Implement paginate() utility (was an unimplemented stub) - Fix auth middleware HTTP method case-sensitivity for public routes - Add missing badRequest import in users route handler - Align shared User type field name (userName -> username) to match contract - Configure node/bun types in tsconfig to resolve type errors
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 TypeScript HTTP API repo. Final state: 22 tests pass, 0 fail;
tsc --noEmitclean.Changes
packages/shared/src/utils/pagination.ts): implemented the previously stubbedpaginate()(page slicing,total,totalPages,page,pageSize, empty/out-of-range handling) to satisfy the test contract.packages/api/src/middleware/auth.ts): fixed an HTTP-method case-sensitivity bug that causedPOST /usersnot to be treated as a public route; resolved theprocesstype error via tsconfig types.packages/api/src/routes/users.ts): added the missingbadRequestimport causing a runtime failure for the missing-fields case.packages/shared/src/types.ts): aligned theUserfield name tousernameto match the contract used across both packages and the tests.Cannot find name 'process'andCannot find module 'bun:test'errors.Verification
bun test→ 22 pass / 0 failnpx tsc --noEmit→ exit 0Assumptions
username(notuserName) because the unmodifiable test files referenceusername; the shared type and source usages were aligned to the tests, which are the contract.