mirror of
https://github.com/mastermindzh/rickvanlieshout.com
synced 2025-09-11 18:56:15 +02:00
28 lines
775 B
TypeScript
28 lines
775 B
TypeScript
import React from "react";
|
|
import renderer from "react-test-renderer";
|
|
|
|
import { StaticQuery, useStaticQuery } from "gatsby";
|
|
|
|
import CategoriesTemplate from "./CategoriesTemplate";
|
|
import * as mocks from "@/mocks";
|
|
|
|
const mockedStaticQuery = StaticQuery as jest.Mock;
|
|
const mockedUseStaticQuery = useStaticQuery as jest.Mock;
|
|
|
|
describe("CategoriesTemplate", () => {
|
|
beforeEach(() => {
|
|
const props = {
|
|
...mocks.siteMetadata,
|
|
allMarkdownRemark: mocks.allMarkdownRemark,
|
|
};
|
|
|
|
mockedStaticQuery.mockImplementationOnce(({ render }) => render(props));
|
|
mockedUseStaticQuery.mockReturnValue(props);
|
|
});
|
|
|
|
it("renders correctly", () => {
|
|
const tree = renderer.create(<CategoriesTemplate />).toJSON();
|
|
expect(tree).toMatchSnapshot();
|
|
});
|
|
});
|