Skip to content

Commit 15c96d9

Browse files
committed
chore: add a gatsby mock
1 parent 6fc0bcf commit 15c96d9

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

__mocks__/gatsby.js

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
const React = require('react');
2+
const gatsby = jest.requireActual('gatsby');
3+
4+
module.exports = {
5+
...gatsby,
6+
graphql: jest.fn(),
7+
Link: jest.fn().mockImplementation(
8+
// these props are invalid for an `a` tag
9+
({
10+
activeClassName,
11+
activeStyle,
12+
getProps,
13+
innerRef,
14+
partiallyActive,
15+
ref,
16+
replace,
17+
to,
18+
...rest
19+
}) =>
20+
React.createElement('a', {
21+
...rest,
22+
href: to,
23+
})
24+
),
25+
StaticQuery: jest.fn(),
26+
useStaticQuery: jest.fn(),
27+
};

0 commit comments

Comments
 (0)