rickvanlieshout.com/src/templates/categories-list-template.test.js
2019-05-09 16:57:42 +03:00

28 lines
772 B
JavaScript

import React from 'react';
import renderer from 'react-test-renderer';
import { useStaticQuery, StaticQuery } from 'gatsby';
import CategoriesListTemplate from './categories-list-template';
import siteMetadata from '../../jest/__fixtures__/site-metadata';
import allMarkdownRemark from '../../jest/__fixtures__/all-markdown-remark';
describe('CategoriesListTemplate', () => {
const props = {
...siteMetadata,
...allMarkdownRemark
};
beforeEach(() => {
StaticQuery.mockImplementationOnce(
({ render }) => (
render(props)
),
useStaticQuery.mockReturnValue(props)
);
});
it('renders correctly', () => {
const tree = renderer.create(<CategoriesListTemplate />).toJSON();
expect(tree).toMatchSnapshot();
});
});