refactor(starter): upgrade to new version of gatsby

This commit is contained in:
Alexander Shelepenok
2022-01-09 20:12:31 +00:00
parent 84bdc5899d
commit 67ebabbaac
397 changed files with 26665 additions and 34984 deletions

View File

@@ -0,0 +1,32 @@
import React from "react";
import renderer from "react-test-renderer";
import { StaticQuery, useStaticQuery } from "gatsby";
import * as mocks from "@/mocks";
import IndexTemplate from "./IndexTemplate";
const mockedStaticQuery = StaticQuery as jest.Mock;
const mockedUseStaticQuery = useStaticQuery as jest.Mock;
describe("IndexTemplate", () => {
const props = {
data: {
...mocks.allMarkdownRemark,
},
...mocks.pageContext,
};
beforeEach(() => {
mockedStaticQuery.mockImplementationOnce(({ render }) =>
render(mocks.siteMetadata),
);
mockedUseStaticQuery.mockReturnValue(mocks.siteMetadata);
});
it("renders correctly", () => {
const tree = renderer.create(<IndexTemplate {...props} />).toJSON();
expect(tree).toMatchSnapshot();
});
});