How are people testing their applications when the frontend is React? I am using the latest 1.3 beta of Meteor with NPM support (thank God!), but not able to find clear guidance on testing. I would like to bring in a suite of unit and acceptance tests for our Meteor app, but all the logic is happening in React. Would love to hear how people are dealing with this :).
Iām a fan of how Mantra goes about testing React views by using enzyme.
Example:
const { describe, it } = global;
import {expect} from 'chai';
import {shallow} from 'enzyme';
import Post from '../index.jsx';
describe('components.post', () => {
it('should display the post title', () => {
const post = {title: 'Nice One'};
const el = shallow(<Post post={post} />);
expect(el.find('h2').text()).to.be.match(/Nice One/);
});
});
Mantra Spec
Mantra Example
Here is a kickstarter project for Mantra.
Enzyme by airbnb
1 Like
Thanks for the resources! Would still be nice to have an example Meteor 1.3 project with a React front-end, react-router and testing, but I will sift through and try to find something that works!