fix: repair failing tests and type errors across api and shared packages - #98
Open
stooit wants to merge 1 commit into
Open
fix: repair failing tests and type errors across api and shared packages#98stooit wants to merge 1 commit into
stooit wants to merge 1 commit into
Conversation
- implement paginate() stub with correct slicing, totals, and edge-case handling - fix auth middleware public-method allow-list (uppercase HTTP method comparison) - add missing badRequest import in users route - reconcile User.username field name across shared types and api route - wire @types/node/bun-types via tsconfig typeRoots (no new dependency)
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
Makes
bun test && bunx tsc --noEmitfully pass — 22/22 tests green, zero type errors. Fixes span both theapiandsharedpackages. No test files were modified and no dependencies were added.Fixes
packages/shared/src/utils/pagination.ts): implemented thepaginate()stub per the test contract — page slicing,total/totalPages,page/pageSize, out-of-range → empty data, empty-array handling, and a divide-by-zero guard forsize = 0.packages/api/src/middleware/auth.ts): fixed a case-sensitivity bug — the public-route allow-list now compares against uppercase HTTP methods (Hono exposesc.req.methodas uppercase), soPOST /usersis correctly public.packages/api/src/routes/users.ts): added the missingbadRequestimport that caused a runtime/type failure, and reconciled the request-body field tousername.packages/shared/src/types.ts): renamedUser.userName→usernameto match what the route, db layer, and tests all expect (tests treated as source of truth).tsconfig.json): addedtypeRoots/typesso TypeScript resolves the already-installed@types/nodeandbun-types. Pure compiler config — no new dependency.Assumptions
username) and API contract; non-test code was changed to match.@types/nodeandbun-typeswere already present innode_modules; the tsconfig change only points the compiler at them.Verification
bun test→ 22 pass, 0 failbunx tsc --noEmit→ exit 0, no errors