mirror of
https://github.com/mastermindzh/rickvanlieshout.com
synced 2025-10-30 16:20:24 +01:00
refactor(starter): upgrade to new version of gatsby
This commit is contained in:
25
src/components/Post/Author/Author.test.tsx
Normal file
25
src/components/Post/Author/Author.test.tsx
Normal file
@@ -0,0 +1,25 @@
|
||||
import React from "react";
|
||||
import renderer from "react-test-renderer";
|
||||
|
||||
import { StaticQuery, useStaticQuery } from "gatsby";
|
||||
|
||||
import { Author } from "@/components/Post/Author";
|
||||
import * as mocks from "@/mocks";
|
||||
|
||||
const mockedStaticQuery = StaticQuery as jest.Mock;
|
||||
const mockedUseStaticQuery = useStaticQuery as jest.Mock;
|
||||
|
||||
describe("Author", () => {
|
||||
console.log(mockedStaticQuery);
|
||||
beforeEach(() => {
|
||||
mockedStaticQuery.mockImplementationOnce(({ render }) =>
|
||||
render(mocks.siteMetadata),
|
||||
);
|
||||
mockedUseStaticQuery.mockReturnValue(mocks.siteMetadata);
|
||||
});
|
||||
|
||||
it("renders correctly", () => {
|
||||
const tree = renderer.create(<Author />).toJSON();
|
||||
expect(tree).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user