rickvanlieshout.com/jest/__mocks__/gatsby.js

30 lines
474 B
JavaScript
Raw Normal View History

'use strict';
const React = require('react');
const gatsby = jest.requireActual('gatsby');
module.exports = {
...gatsby,
graphql: jest.fn(),
Link: jest.fn().mockImplementation(
({
activeClassName,
activeStyle,
getProps,
innerRef,
ref,
replace,
to,
...rest
}) => (
React.createElement('a', {
...rest,
href: to,
})
)
),
StaticQuery: jest.fn(),
2019-05-09 15:43:21 +02:00
useStaticQuery: jest.fn()
};