Conversation
Replace Jest-based test setup with native node:test/assert and update CI. Tests were refactored to use node:test and node:assert (many __tests__ updated), new auth token unit tests added, and routes_mounted.test.js reworked to a data-driven style. The database mock was rewritten to remove Jest-specific APIs and provide a lightweight mock/registry with resetMocks; jest.config.js was removed. GitHub Actions workflows now separate install, test (npm run test:ci) and coverage (npm run coverage:ci) steps. package.json dev tooling and test scripts were adjusted accordingly, and test bootstrap/loader/coverage artifacts were added while placeholder .txt test files were removed.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Introduce createPatchOverrideMiddleware in rest.js to centralize validation of X-HTTP-Method-Override for POST-to-PATCH requests. Replace duplicated inline checks in routes/patchSet.js, routes/patchUnset.js, and routes/patchUpdate.js with the new middleware (each using a route-specific statusMessage). Also standardize error handling by ending 405 responses with res.status(405).end() and export the new middleware from rest.js.
Replace patterns that set status and call next(res) with res.status(405).end() in route fallbacks (routes/query.js, routes/release.js, routes/search.js) to ensure the response is terminated immediately. Add route wrapper tests (routes/__tests__/route_wrappers.test.js) to validate method-override handling, unsupported-method fallbacks, client verify behavior, and API discovery. Include a test coverage inventory (test/coverage-inventory.json) to record current test/coverage state.
Replace next(res) with res.status(405).end() in multiple route fallbacks to ensure responses are terminated immediately (bulkCreate, bulkUpdate, create, delete, history, id, overwrite, putUpdate, since). Update route wrapper tests to import additional routers, add helper asserting fallback behavior on specific paths, and add tests for static/index handlers. Update test coverage inventory to reflect the new/updated tests.
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.
extending to the rest of the routes