2019-04-23 15:18:57 +02:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* Strapi
|
|
|
|
* This file allow to mock any key that is in the global strapi variable
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
// Setup the strapi functioon global variable
|
|
|
|
|
|
|
|
const React = require('react');
|
|
|
|
const hoistNonReactStatics = require('hoist-non-react-statics');
|
|
|
|
|
|
|
|
const hoc = () => WrappedComponent => {
|
|
|
|
class HocInjector extends React.Component {
|
|
|
|
static WrappedComponent = WrappedComponent;
|
|
|
|
|
|
|
|
render() {
|
|
|
|
return <WrappedComponent {...this.props} />;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return hoistNonReactStatics(HocInjector, WrappedComponent);
|
|
|
|
};
|
|
|
|
|
|
|
|
global.strapi = {
|
2020-03-24 07:35:16 +01:00
|
|
|
backendURL: 'http://localhost:1337',
|
2019-04-23 15:18:57 +02:00
|
|
|
injectReducer: hoc,
|
|
|
|
injectSaga: hoc,
|
|
|
|
notification: {
|
|
|
|
error: jest.fn(),
|
|
|
|
info: jest.fn(),
|
|
|
|
success: jest.fn(),
|
|
|
|
warning: jest.fn(),
|
|
|
|
},
|
|
|
|
};
|