I am testing component using withTracker
in its container.
An error happens:
TypeError: (0 , _reactMeteorData.withTracker) is not a function.
I think I haven't mock the react-meteor-data/withTracker yet. Can someone tell me how to mock it? Or is there any solution for this?
Inspired by How is Meteor's withTracker function executed differently than the former reactive container function createContainer? I managed to upgrade the tests from createContainer to withTracker using the following:
In your mocked react-meteor-data.js file.
const createContainer = jest.fn((options = {}, component) => component );
const withTracker = jest.fn(Op => jest.fn(C => createContainer(Op, C)));
Then export withTracker instead of createContainer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With