Skip to content

Commit

Permalink
Mock fetch call for jest tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aemandine committed Aug 19, 2024
1 parent 047b960 commit 81a8989
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/perseus/src/widgets/__tests__/phet-sim.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ describe("phet-sim widget", () => {
jest.spyOn(Dependencies, "getDependencies").mockReturnValue(
testDependencies,
);
global.fetch = jest.fn(() =>
Promise.resolve({
json: () => Promise.resolve({test: 100}),
}),
) as jest.Mock;
});

it("should snapshot", () => {
Expand Down

0 comments on commit 81a8989

Please sign in to comment.