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