fix: repair failing tests across api and shared packages#82
Open
stooit wants to merge 1 commit into
Open
Conversation
- Implement paginate() util (was a stub throwing not-implemented) - Fix auth middleware HTTP-method case bug (post -> POST) so POST /users is public - Rename shared User field userName -> username to match API and tests - Add missing badRequest import in users route handler - Add bun-types to tsconfig types so process/bun:test resolve under tsc
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 9 failing tests and eliminates all
tsc --noEmiterrors across theapiandsharedpackages. Baseline was 13 pass / 9 fail; now 22 pass / 0 fail andtsc --noEmitis clean.Bugs fixed
packages/shared/src/utils/pagination.ts): was a stub throwingnot implemented. Implemented 1-indexed paging —start = (page-1)*size, end-exclusive slice,totalPages = ceil(total/size)(0 for empty input).packages/api/src/middleware/auth.ts): public-methods list held lowercase"post"but Hono reports methods uppercase, soPOST /userswas never treated as public. Changed to"POST".packages/shared/src/types.ts):User.userNamerenamed tousernameto match what the API route and tests use.packages/api/src/routes/users.ts): addedbadRequestto the import from../lib/errors(already exported there) — was a runtime/type failure in the 400-validation path.tsconfig.json): added"types": ["bun-types"]soprocessand thebun:testmodule resolve undertsc.bun-typeswas already installed — no new dependencies.Verification
bun test→ 22 pass, 0 fail (37 expect() calls, 4 files)npx tsc --noEmit→ clean (exit 0)Assumptions
userName→usernamedirection, driven by the tests).bun-types.