chore(tests): mock static query

This commit is contained in:
Alexander Shelepenok 2022-04-17 14:10:09 +00:00
parent c7c5a6ae2b
commit 3b8f9ba02b

View File

@ -1,10 +1,18 @@
import React from "react";
import renderer from "react-test-renderer";
import { StaticQuery } from "gatsby";
import { Author } from "@/components/Sidebar/Author";
import * as mocks from "@/mocks";
const mockedStaticQuery = StaticQuery as jest.Mock;
describe("Author", () => {
beforeEach(() => {
mockedStaticQuery.mockImplementationOnce(() => null);
});
it("renders correctly", () => {
const props = { isIndex: false, author: mocks.author };
const tree = renderer.create(<Author {...props} />).toJSON();