mirror of
https://github.com/mastermindzh/rickvanlieshout.com
synced 2025-09-10 10:16:21 +02:00
25 lines
798 B
TypeScript
25 lines
798 B
TypeScript
import { StaticQuery, useStaticQuery } from "gatsby";
|
|
import React from "react";
|
|
import renderer from "react-test-renderer";
|
|
import * as mocks from "@/mocks";
|
|
import { Content } from "@/components/Post/Content";
|
|
|
|
const mockedStaticQuery = StaticQuery as jest.Mock;
|
|
const mockedUseStaticQuery = useStaticQuery as jest.Mock;
|
|
|
|
describe("Content", () => {
|
|
beforeEach(() => {
|
|
mockedStaticQuery.mockImplementationOnce(({ render }) => render(mocks.siteMetadata));
|
|
mockedUseStaticQuery.mockReturnValue(mocks.siteMetadata);
|
|
});
|
|
it("renders correctly", () => {
|
|
const props = {
|
|
title: mocks.markdownRemark.frontmatter.title,
|
|
body: mocks.markdownRemark.html,
|
|
};
|
|
|
|
const tree = renderer.create(<Content {...props} />).toJSON();
|
|
expect(tree).toMatchSnapshot();
|
|
});
|
|
});
|