@ndlib/gatsby-theme-marble/__mocks__/gatsby.js
const React = require('react')
const gatsby = jest.requireActual('gatsby')
module.exports = {
...gatsby,
graphql: jest.fn(),
Link: jest.fn().mockImplementation(
// these props are invalid for an `a` tag
({
activeClassName,
activeStyle,
getProps,
innerRef,
ref,
replace,
to,
...rest
}) =>
React.createElement('a', {
...rest,
href: to,
})
),
Slice: jest.fn().mockImplementation(
({ alias, ...rest }) =>
React.createElement('div', {
...rest,
'data-test-slice-alias': alias
})
),
StaticQuery: jest.fn(),
useStaticQuery: jest.fn(),
navigate: jest.fn(),
}