Migrate tests from deno-mock-fetch to fetch-mock#247
Merged
Conversation
Replace @hongminhee/deno-mock-fetch with fetch-mock across test files for improved compatibility and standardization. Updates test mocking patterns in nodeinfo, runtime, sig, vocab, and webfinger modules.
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR swaps out the @hongminhee/deno-mock-fetch test mocks for fetch-mock across several modules to standardize on a Node-compatible mocking library.
- Replace
mf.install()/mf.mock()/mf.uninstall()withfetchMock.spyGlobal()/fetchMock.get|post()/fetchMock.removeRoutes()/fetchMock.hardReset() - Update route matchers to use URL patterns understood by
fetch-mock - Remove the old
deno-mock-fetchdependency from bothpackage.jsonanddeno.json
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| fedify/webfinger/lookup.test.ts | Swap in fetch-mock for WebFinger request mocks |
| fedify/vocab/actor.test.ts | Migrate actor tests to use fetch-mock |
| fedify/sig/http.test.ts | Convert HTTP signature tests to fetch-mock POST handlers |
| fedify/runtime/docloader.test.ts | Update document loader tests with fetch-mock GET handlers |
| fedify/nodeinfo/client.test.ts | Change NodeInfo client tests to fetch-mock GET mocks |
| fedify/package.json | Remove @hongminhee/deno-mock-fetch dev dependency |
| fedify/deno.json | Remove @hongminhee/deno-mock-fetch import |
Comments suppressed due to low confidence (1)
fedify/sig/http.test.ts:1173
- [nitpick] The parameter name
clin thisfetchMockcallback is not descriptive. Consider renaming it to something likeurl, optsorcallInfoto clarify what it represents.
fetchMock.post("https://example.com/inbox-accepts-rfc9421", (cl) => {
Contributor
|
The latest push to this pull request has been published to JSR and npm as a pre-release: |
Contributor
|
The docs for this pull request have been published: |
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.
Replace @hongminhee/deno-mock-fetch with fetch-mock across test files for improved compatibility and standardization. Updates test mocking patterns in nodeinfo, runtime, sig, vocab, and webfinger modules.