Skip to content

Migrate tests from deno-mock-fetch to fetch-mock#247

Merged
dahlia merged 1 commit into
fedify-dev:mainfrom
dahlia:main
Jun 4, 2025
Merged

Migrate tests from deno-mock-fetch to fetch-mock#247
dahlia merged 1 commit into
fedify-dev:mainfrom
dahlia:main

Conversation

@dahlia
Copy link
Copy Markdown
Member

@dahlia dahlia commented Jun 4, 2025

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.

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.
@dahlia dahlia added this to the Fedify 1.6 milestone Jun 4, 2025
@dahlia dahlia requested a review from Copilot June 4, 2025 05:29
@dahlia dahlia self-assigned this Jun 4, 2025
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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() with fetchMock.spyGlobal()/fetchMock.get|post()/fetchMock.removeRoutes()/fetchMock.hardReset()
  • Update route matchers to use URL patterns understood by fetch-mock
  • Remove the old deno-mock-fetch dependency from both package.json and deno.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 cl in this fetchMock callback is not descriptive. Consider renaming it to something like url, opts or callInfo to clarify what it represents.
fetchMock.post("https://example.com/inbox-accepts-rfc9421", (cl) => {

Comment thread fedify/runtime/docloader.test.ts
Comment thread fedify/webfinger/lookup.test.ts
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 4, 2025

The latest push to this pull request has been published to JSR and npm as a pre-release:

@dahlia dahlia temporarily deployed to github-pages June 4, 2025 05:42 — with GitHub Actions Inactive
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 4, 2025

The docs for this pull request have been published:

https://49d68fef.fedify.pages.dev

@dahlia dahlia merged commit dd01737 into fedify-dev:main Jun 4, 2025
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/nodeinfo NodeInfo related status/ready for review Ready for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants