fix: resolve all failing tests and type errors#67
Open
stooit wants to merge 1 commit into
Open
Conversation
…ages - auth middleware: fix case-sensitivity bug in public HTTP methods (post -> POST) and use Bun.env instead of process.env (no @types/node in scope) - users route: add missing badRequest import and align field name to canonical userName - shared types: align User field name to userName for cross-package consistency - pagination: implement paginate() stub to satisfy the full test contract - tsconfig: add bun-types reference so test files resolve bun:test and env
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 eliminates all type errors across the
apiandsharedpackages. Final state: 22 pass / 0 fail,tsc --noEmitclean.Changes
packages/api/src/middleware/auth.ts): fixed a case-sensitivity bug where the public-methods check used"post"while Hono reports HTTP methods uppercased —POST /usersis now correctly treated as public (no token required). Also switchedprocess.env.API_TOKENtoBun.env.API_TOKENsince@types/nodeis not in scope.packages/api/src/routes/users.ts): added the missingbadRequestimport (runtime failure) and aligned the response field name to the canonicaluserName.packages/shared/src/types.ts): aligned theUserfield name touserNameto resolve the cross-package inconsistency the tests expect.packages/shared/src/utils/pagination.ts): implemented the previously-stubbedpaginate()to satisfy the full test contract (page slicing, totals/totalPages, page/pageSize, out-of-range and empty-array handling).tsconfig.json): added abun-typesreference so test files resolvebun:testand Bun env typings — no new dependencies added.Assumptions
userName, taken from what the (unmodified) test files reference; source was aligned to the tests rather than vice versa.bun:test/processtype errors in test files were a tsconfig types-resolution gap, fixed via config only — no test files were modified and no dependencies added.Verification
bun test→ 22 pass, 0 failbunx tsc --noEmit→ no errors🤖 Generated autonomously.