mirror of
https://github.com/mastermindzh/rickvanlieshout.com
synced 2025-02-05 18:12:29 +01:00
29 lines
827 B
TypeScript
29 lines
827 B
TypeScript
import React from "react";
|
|
import renderer from "react-test-renderer";
|
|
|
|
import { StaticQuery, useStaticQuery } from "gatsby";
|
|
|
|
import { Layout } from "@/components/Layout";
|
|
import * as mocks from "@/mocks";
|
|
|
|
const mockedStaticQuery = StaticQuery as jest.Mock;
|
|
const mockedUseStaticQuery = useStaticQuery as jest.Mock;
|
|
|
|
describe("Layout", () => {
|
|
const props = {
|
|
...mocks.siteMetadata,
|
|
title: mocks.siteMetadata.site.siteMetadata.title,
|
|
description: mocks.siteMetadata.site.siteMetadata.subtitle,
|
|
};
|
|
|
|
beforeEach(() => {
|
|
mockedStaticQuery.mockImplementationOnce(({ render }) => render(props));
|
|
mockedUseStaticQuery.mockReturnValue(props);
|
|
});
|
|
|
|
it("renders correctly", () => {
|
|
const tree = renderer.create(<Layout {...props}>test</Layout>).toJSON();
|
|
expect(tree).toMatchSnapshot();
|
|
});
|
|
});
|