fix: repair failing tests and type errors across api and shared packages - #101
Open
stooit wants to merge 1 commit into
Open
fix: repair failing tests and type errors across api and shared packages#101stooit wants to merge 1 commit into
stooit wants to merge 1 commit into
Conversation
- shared: rename User.userName to username to match test contract
- shared: implement paginate() utility (was an unimplemented stub)
- api: import badRequest into users route (missing import)
- api: fix case-sensitive HTTP method check in auth middleware ('post' -> 'POST')
- tsconfig: add bun-types to resolve 'bun:test' module and 'process' global
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 so
bun test && bunx tsc --noEmitis fully green (22 pass, 0 fail; tsc clean).Root causes spanned both packages:
User.userNamerenamed tousernameto match the contract the tests (and API routes) expect.paginate()was an unimplemented stub that threw"not implemented"; implemented it to satisfy the full test contract (1-based paging, partial last page, out-of-range → empty data, correcttotal/totalPages).badRequestwas used but never imported; added it to the../lib/errorsimport.'post'against Hono's uppercasec.req.method, soPOST /userswasn't treated as public; fixed literal to'POST'."types": ["bun-types"](already installed) to resolveCannot find module 'bun:test'and theprocessglobal. No new dependencies added.Verification
bun test→ 22 pass, 0 fail across 4 filesbunx tsc --noEmit→ clean (exit 0)Notes / assumptions
username) was derived from the tests.usernamerename was verified consistent across all source usages — nouserNameremains anywhere in source or tests.paginate(..., size=0)yieldstotalPages: Infinity. Not exercised by any test andpageSizeisn't user-controlled in current routes, so left unguarded to stay within scope.