Skip to content

Commit

Permalink
mock React.createContext
Browse files Browse the repository at this point in the history
  • Loading branch information
yesmeck committed Jul 11, 2018
1 parent 4788432 commit ea42973
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/__mocks__/react.js
Original file line number Diff line number Diff line change
@@ -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;

0 comments on commit ea42973

Please sign in to comment.