26 lines
699 B
TypeScript

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