I want to stub a dependency with proxyquire in a unit test (the dependency is a React component):
import proxyquire from 'proxyquire';
let Parent = proxyquire
.noCallThru()
.load('../../src/js/components/client.jsx', {
'./Child.jsx': React.Component
});
And get an error:
Error: Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.
I've tried to change React.Component to be just 'div', but it makes no difference.
Aucun commentaire:
Enregistrer un commentaire