Conversation
…ername field - Implement paginate() in shared/utils per the pagination test contract - Fix auth middleware public-route method matching to be case-insensitive - Add missing badRequest import in users route (was causing runtime ReferenceError) - Align User.username field name across packages (source of truth: tests) - Configure tsconfig typeRoots so bun:test and process resolve from bun-types (no new deps)
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 14
tsc --noEmittype errors. Final state: 22 tests pass, 0 fail;tsc --noEmitexits clean. No test files modified, no dependencies added.Changes
packages/shared/src/utils/pagination.tspaginate()stub per the test contract (page slice, page/pageSize, total/totalPages, empty data for out-of-range page, empty array).packages/api/src/middleware/auth.ts.toUpperCase()) soPOST /usersis correctly treated as public regardless of casing.packages/api/src/routes/users.tsbadRequestimport from../lib/errors(was causing a runtime ReferenceError → the "returns 400 for missing fields" test failed).packages/shared/src/types.tsUser.userName→usernameto match the field name asserted by the tests across both packages.tsconfig.jsontypeRoots+types: ["bun-types"]sobun:testandprocessresolve from the already-installedbun-types(no new deps).Assumptions / decisions documented
userName, but the tests (which must not change) all assert lowercaseusername, and 4 of the TS2561 errors originated inside test files. The tests are the source of truth, so the sharedUsertype was changed tousernameinstead — the only change that satisfies the un-editable tests.@types/nodenot installed: onlybun-typesandtypescriptare present innode_modules.bun-typesbundles its own node type references, so pointingtypeRootsat./node_modulesresolves bothbun:testandprocesswithout adding@types/node.page/pageSizeare clamped withMath.max(1, ...)to avoid negative slice windows on zero/negative input. Not covered by tests; chosen as safe default behaviour.Follow-up (not done — out of scope, not required by tests)
README.md"Known issues" still documents the old (incorrect) rename direction and references a docstring that was removed fromshared/src/types.ts.