mirror of
https://github.com/mastermindzh/rickvanlieshout.com
synced 2024-12-27 07:18:17 +01:00
Fix tests.
This commit is contained in:
parent
ebc6134453
commit
488841cf47
@ -1,15 +1,27 @@
|
|||||||
// @flow strict
|
// @flow strict
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import renderer from 'react-test-renderer';
|
import renderer from 'react-test-renderer';
|
||||||
|
import { useStaticQuery, StaticQuery } from 'gatsby';
|
||||||
|
import siteMetadata from '../../../jest/__fixtures__/site-metadata';
|
||||||
import Layout from './Layout';
|
import Layout from './Layout';
|
||||||
|
|
||||||
describe('Layout', () => {
|
describe('Layout', () => {
|
||||||
const props = {
|
const props = {
|
||||||
|
...siteMetadata,
|
||||||
children: 'test',
|
children: 'test',
|
||||||
description: 'test',
|
description: 'test',
|
||||||
title: 'test'
|
title: 'test'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
StaticQuery.mockImplementationOnce(
|
||||||
|
({ render }: RenderCallback) => (
|
||||||
|
render(props)
|
||||||
|
),
|
||||||
|
useStaticQuery.mockReturnValue(props)
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
it('renders correctly', () => {
|
it('renders correctly', () => {
|
||||||
const tree = renderer.create(<Layout {...props} />).toJSON();
|
const tree = renderer.create(<Layout {...props} />).toJSON();
|
||||||
expect(tree).toMatchSnapshot();
|
expect(tree).toMatchSnapshot();
|
||||||
|
Loading…
Reference in New Issue
Block a user