Hey Gang,
Thought I’d share my experience testing React components with Meteor tinytest and React.addons.TestUtils. I’d be happy to hear your feedback on the article / testing tips as well:
http://tauruscolvin.com/testing-react-components-in-meteor/
Cheers,
Taurus
6 Likes
bcbrian
December 16, 2015, 6:55pm
2
This is pretty amazing! The only thing I saw missing to get this to work was this. (Atleast I did not see being clearly expressed)
Package.onTest(function(api) {
api.use('ecmascript');
api.use([
'react'
], 'client');
api.use('nifty-package');
api.addFiles('nifty-package-tests.jsx');
});
I had to add react explicitly to the testing block and make the tests file a jsx file. Other wise it would error trying to read the line
component = utils.renderIntoDocument(<CoolComponent/>);
Because it is not valid JS.
Thank you so much for putting this out there