mock React.createContext

This commit is contained in:
Wei Zhu 2018-07-11 11:16:37 +08:00
parent 47884320ef
commit ea42973ace

11
tests/__mocks__/react.js vendored Normal file
View File

@ -0,0 +1,11 @@
const React = require.requireActual('react');
if (!React.createContext) {
React.createContext = () => {
const Provider = ({ children }) => children;
const Consumer = ({ children }) => children();
return { Provider, Consumer };
};
}
module.exports = React;