Skip to content

Instantly share code, notes, and snippets.

@josescasanova
Forked from thevangelist/my-component.spec.js
Created August 11, 2016 18:21
Show Gist options
  • Save josescasanova/f86b4bddb521ffb41d1c9f3d9f8b53c7 to your computer and use it in GitHub Desktop.
Save josescasanova/f86b4bddb521ffb41d1c9f3d9f8b53c7 to your computer and use it in GitHub Desktop.
The only React.js component test you'll ever need (Enzyme + Chai)
import React from 'react';
import { shallow } from 'enzyme';
import MyComponent from '../src/my-component';
const wrapper = shallow(<MyComponent/>);
describe('(Component) MyComponent', () => {
it('renders without exploding', () => {
expect(wrapper).to.have.length(1);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment