fix: repair failing tests and type errors across api and shared packages#77
Open
stooit wants to merge 1 commit into
Open
fix: repair failing tests and type errors across api and shared packages#77stooit wants to merge 1 commit into
stooit wants to merge 1 commit into
Conversation
- implement paginate() utility in shared package (was a stub)
- rename User.userName -> username for cross-package consistency
- add missing badRequest import in users route handler
- fix auth middleware HTTP-method case comparison ('post' -> 'POST')
- scope tsconfig types to bun-types to resolve tsc 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 Bun + Hono monorepo. All 22 tests pass and
tsc --noEmitis clean.Changes
shared: implementpaginate<T>()— was a stub throwing "not implemented". Now slices by(page-1)*size, computestotal/totalPages, and returns{ data, page, pageSize, total, totalPages }. Handles empty arrays, partial last pages, and out-of-range pages.shared: renameUser.userName→username— the field name was inconsistent between packages; aligned to what the (unmodifiable) tests expect, updating all handler/db usages.api: add missingbadRequestimport inroutes/users.ts(was "Cannot find name 'badRequest'").api: fix auth middleware HTTP-method case bug — public-method comparison used lowercase'post'where Hono'sc.req.methodreturns uppercase'POST', soPOST /userswas incorrectly requiring a token.tsconfig: scopetypesto["bun-types"]— resolvesbun:test/processtype errors under tsc.bun-typesis an existing devDependency; no new dependencies added.Verification
bun test→ 22 pass, 0 failbunx tsc --noEmit→ no errorsAssumptions
usernamefield name.size <= 0guard inpaginate, echoing out-of-rangepage, a restored policy comment) were intentionally left out of scope — no test exercises those paths and no current caller invokespaginate.Constraints honoured