Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove global node-fetch mock. #14297

Merged
merged 14 commits into from
Aug 2, 2024
Merged

Remove global node-fetch mock. #14297

merged 14 commits into from
Aug 2, 2024

Conversation

samwho
Copy link
Collaborator

@samwho samwho commented Aug 1, 2024

Description

This PR removes the global __mocks__/node-fetch.ts file in packages/server in favour of using nock where needed.

Additionally I've set up nock to disallow any requests to the internet outside of localhost.

@github-actions github-actions bot added firestorm Data/Infra/Revenue Team size/l labels Aug 1, 2024
@samwho samwho marked this pull request as ready for review August 1, 2024 14:50
@samwho samwho requested a review from a team as a code owner August 1, 2024 14:50
@samwho samwho requested review from adrinr and removed request for a team August 1, 2024 14:50
@@ -75,14 +84,9 @@ export async function create(ctx: any) {
const doc = await pro.plugins.storePlugin(metadata, directory, source)

clientAppSocket?.emit("plugins-update", { name, hash: doc.hash })
ctx.body = {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice find!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It fell out after I typed the response object.

Copy link
Collaborator

@mike12345567 mike12345567 left a comment

Choose a reason for hiding this comment

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

LGTM! Very nice!

@samwho samwho merged commit d24d39a into master Aug 2, 2024
12 checks passed
@samwho samwho deleted the node-fetch-mockectomy branch August 2, 2024 10:07
@github-actions github-actions bot locked and limited conversation to collaborators Aug 2, 2024
@@ -75,14 +84,9 @@ export async function create(ctx: any) {
const doc = await pro.plugins.storePlugin(metadata, directory, source)

clientAppSocket?.emit("plugins-update", { name, hash: doc.hash })
ctx.body = {
Copy link
Collaborator

Choose a reason for hiding this comment

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

😅

await config.api.application.delete(app.appId)
expect(events.app.deleted).toHaveBeenCalledTimes(1)
expect(events.app.unpublished).toHaveBeenCalledTimes(1)
})

it("should delete published app and dev app with prod app ID", async () => {
await config.api.application.delete(app.appId.replace("_dev", ""))
const prodAppId = app.appId.replace("_dev", "")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this part of the test? It looks like all the tests are doing the same, probably are part of the setup instead

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
firestorm Data/Infra/Revenue Team size/l
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants