fix: repair failing tests and type errors across api and shared packages#76
Open
stooit wants to merge 1 commit into
Open
fix: repair failing tests and type errors across api and shared packages#76stooit wants to merge 1 commit into
stooit wants to merge 1 commit into
Conversation
- Implement paginate() utility in shared package (was a throwing stub) - Fix case-sensitivity bug in auth middleware so POST /users is public - Align User type field naming with tests; import badRequest helper in users route - Include node/bun types in tsconfig to resolve type-resolution 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 TypeScript errors across the
apiandsharedpackages. Final state: 22/22 tests pass andtsc --noEmitis clean.Changes
packages/shared/src/utils/pagination.ts) — implemented thepaginate<T>()utility, which was a throwing stub. ComputestotalandtotalPages, slices by(page-1)*size, and returns emptydatafor out-of-range pages.packages/api/src/middleware/auth.ts) — fixed an HTTP-method case-sensitivity bug soPOST /usersis correctly treated as a public (no-token) route.packages/shared/src/types.ts,packages/api/src/routes/users.ts) — aligned theUsertype field name with the spelling the tests expect, resolving cross-package type mismatches, and imported the missingbadRequestresponse helper in the users route.tsconfig.json— included the already-installed node/bun type definitions to resolveprocess/bun:testtype-resolution errors. No new dependencies were added.Verification
bun test→ 22 pass, 0 failnpx tsc --noEmit→ clean (exit 0)Constraints honoured
Assumptions
Userfield name; source types and route handlers were aligned to match them.node_modules, so they were referenced via tsconfig rather than installed.