mirror of
https://github.com/mastermindzh/rickvanlieshout.com
synced 2024-12-26 06:49:18 +01:00
chore(tests): mock static query
This commit is contained in:
parent
c7c5a6ae2b
commit
3b8f9ba02b
@ -1,10 +1,18 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import renderer from "react-test-renderer";
|
import renderer from "react-test-renderer";
|
||||||
|
|
||||||
|
import { StaticQuery } from "gatsby";
|
||||||
|
|
||||||
import { Author } from "@/components/Sidebar/Author";
|
import { Author } from "@/components/Sidebar/Author";
|
||||||
import * as mocks from "@/mocks";
|
import * as mocks from "@/mocks";
|
||||||
|
|
||||||
|
const mockedStaticQuery = StaticQuery as jest.Mock;
|
||||||
|
|
||||||
describe("Author", () => {
|
describe("Author", () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
mockedStaticQuery.mockImplementationOnce(() => null);
|
||||||
|
});
|
||||||
|
|
||||||
it("renders correctly", () => {
|
it("renders correctly", () => {
|
||||||
const props = { isIndex: false, author: mocks.author };
|
const props = { isIndex: false, author: mocks.author };
|
||||||
const tree = renderer.create(<Author {...props} />).toJSON();
|
const tree = renderer.create(<Author {...props} />).toJSON();
|
||||||
|
Loading…
Reference in New Issue
Block a user