Files
freeCodeCamp/client/src/__mocks__/gatsby.js

31 lines
585 B
JavaScript
Raw Normal View History

2019-08-30 12:54:01 +03:00
/* eslint-disable no-unused-vars */
/* eslint-disable no-undef */
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,
partiallyActive,
ref,
replace,
to,
...rest
}) =>
React.createElement('a', {
...rest,
href: to
})
),
StaticQuery: jest.fn(),
useStaticQuery: jest.fn()
};