diff --git a/src/components/Layout/Layout.test.js b/src/components/Layout/Layout.test.js index a0ca1c9..96ec84d 100644 --- a/src/components/Layout/Layout.test.js +++ b/src/components/Layout/Layout.test.js @@ -1,15 +1,27 @@ // @flow strict import React from 'react'; import renderer from 'react-test-renderer'; +import { useStaticQuery, StaticQuery } from 'gatsby'; +import siteMetadata from '../../../jest/__fixtures__/site-metadata'; import Layout from './Layout'; describe('Layout', () => { const props = { + ...siteMetadata, children: 'test', description: 'test', title: 'test' }; + beforeEach(() => { + StaticQuery.mockImplementationOnce( + ({ render }: RenderCallback) => ( + render(props) + ), + useStaticQuery.mockReturnValue(props) + ); + }); + it('renders correctly', () => { const tree = renderer.create().toJSON(); expect(tree).toMatchSnapshot();