fix: repair failing tests and type errors across api and shared packages#79
Open
stooit wants to merge 1 commit into
Open
fix: repair failing tests and type errors across api and shared packages#79stooit wants to merge 1 commit into
stooit wants to merge 1 commit into
Conversation
- shared: rename User.userName -> username to match route handlers, db, and tests
- shared: implement paginate() stub with 1-indexed page slicing and edge-case handling
- api: fix auth middleware public-method allow-list ('post' -> 'POST')
- api: add missing badRequest import in users route
- tsconfig: add bun-types so bun:test and node globals resolve
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 all
tsc --noEmittype errors in the bun/Hono workspace.bun testnow passes 22/22 andnpx tsc --noEmitis clean.Changes
User.userName→usernameto match the route handlers, db seed data, and tests (field name was inconsistent between packages).paginate()stub (previously threw "not implemented"). 1-indexed pages:data = items.slice((page-1)*size, ...),total,totalPages = ceil(total/size)(0 when empty), returns emptydatafor out-of-range pages.'post'while Hono'sc.req.methodis uppercase, soPOST /userswas wrongly requiring a token.badRequestimport from../lib/errors(runtime failure on validation path).bun-typessobun:testand node globals (process) resolve. No new dependencies (bun-types already installed).Verification
bun test→ 22 pass, 0 failnpx tsc --noEmit→ cleanConstraints honoured
Assumptions
username(lowercase n) — tests, db seed, and route logic all use it; only the shared type declareduserName.paginatepages are 1-indexed, per the pagination test contract.