mirror of
https://github.com/mastermindzh/rickvanlieshout.com
synced 2025-09-13 03:30:50 +02:00
refactor(starter): upgrade and move to typescript
This commit is contained in:
28
src/templates/CategoriesTemplate/CategoriesTemplate.test.tsx
Normal file
28
src/templates/CategoriesTemplate/CategoriesTemplate.test.tsx
Normal file
@@ -0,0 +1,28 @@
|
||||
import React from "react";
|
||||
import renderer from "react-test-renderer";
|
||||
|
||||
import { StaticQuery, useStaticQuery } from "gatsby";
|
||||
|
||||
import * as mocks from "@/mocks";
|
||||
|
||||
import CategoriesTemplate from "./CategoriesTemplate";
|
||||
|
||||
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();
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user