fix: repair failing tests and type errors across api and shared packages#57
Open
stooit wants to merge 1 commit into
Open
fix: repair failing tests and type errors across api and shared packages#57stooit wants to merge 1 commit into
stooit wants to merge 1 commit into
Conversation
- auth middleware: correct "post" -> "POST" in public-methods allow-list (Hono method strings are uppercase; lowercase never matched) - users route: import missing badRequest helper - shared types: align User field userName -> username to match contract - pagination: implement paginate() stub (slice, totalPages, edge cases) - tsconfig: add @e2e/shared path alias and wire up types
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 type errors. Final state: 22 pass / 0 fail,
tsc --noEmitexits clean.Changes
packages/api/src/middleware/auth.ts"post"→"POST"in the public-methods allow-list. Hono'sc.req.methodis always uppercase, so the lowercase entry never matched andPOST /userswas wrongly treated as auth-required.packages/api/src/routes/users.tsbadRequestimport (wasTS2552: Cannot find name 'badRequest'); aligned field tousername.packages/shared/src/types.tsUserfielduserName→usernamefor cross-package consistency.packages/shared/src/utils/pagination.tspaginate()stub: page slicing,totalPagesviaMath.ceil, out-of-range / empty-array edge cases.tsconfig.json@e2e/sharedpath alias + wired up types so cross-package imports and Node globals (process) type-check.Verification
bun test→ 22 pass, 0 fail (4 files)npx tsc --noEmit→ exit 0, no errorspaginate()edge cases confirmed sound; rename confirmed consistent with no orphaned references.Assumptions
username(notuserName) is canonical, since the unmodifiable test files useusername.@types/nodewas already present; only tsconfig wiring was needed (no new dependencies).Constraints honoured
No test files modified, no new dependencies added.