mirror of
https://github.com/mastermindzh/rickvanlieshout.com
synced 2024-12-27 23:38:07 +01:00
33 lines
935 B
JavaScript
33 lines
935 B
JavaScript
// @flow strict
|
|
import React from 'react';
|
|
import renderer from 'react-test-renderer';
|
|
import { useStaticQuery, StaticQuery } from 'gatsby';
|
|
import CategoryTemplate from './category-template';
|
|
import siteMetadata from '../../jest/__fixtures__/site-metadata';
|
|
import allMarkdownRemark from '../../jest/__fixtures__/all-markdown-remark';
|
|
import pageContext from '../../jest/__fixtures__/page-context';
|
|
import type { RenderCallback } from '../types';
|
|
|
|
describe('CategoryTemplate', () => {
|
|
const props = {
|
|
data: {
|
|
...allMarkdownRemark
|
|
},
|
|
...pageContext
|
|
};
|
|
|
|
beforeEach(() => {
|
|
StaticQuery.mockImplementationOnce(
|
|
({ render }: RenderCallback) => (
|
|
render(siteMetadata)
|
|
),
|
|
useStaticQuery.mockReturnValue(siteMetadata)
|
|
);
|
|
});
|
|
|
|
it('renders correctly', () => {
|
|
const tree = renderer.create(<CategoryTemplate {...props} />).toJSON();
|
|
expect(tree).toMatchSnapshot();
|
|
});
|
|
});
|