import * as React from "react"; import { shallow } from "enzyme"; import HomePage from "src/components/HomePage/HomePage"; import toJson from "enzyme-to-json"; describe(" without knowing isIsolatedServer", () => { jest.spyOn(React, "useContext").mockImplementation(() => ({ isIsolatedServer: null, })); const homePage = shallow(); it("matches snapshot", () => { expect(toJson(homePage)).toMatchSnapshot(); }); }); describe("Isolated Server's ", () => { jest.spyOn(React, "useContext").mockImplementation(() => ({ isIsolatedServer: true, })); const homePage = shallow(); it("matches snapshot", () => { expect(toJson(homePage)).toMatchSnapshot(); }); }); describe("Non-Isolated Server ", () => { jest.spyOn(React, "useContext").mockImplementation(() => ({ isIsolatedServer: false, })); const homePage = shallow(); it("matches snapshot", () => { expect(toJson(homePage)).toMatchSnapshot(); }); });