Skip to content

Instantly share code, notes, and snippets.

@gaboesquivel
Forked from thevangelist/my-component.spec.js
Created November 6, 2017 21:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gaboesquivel/9e10692179904e7c8ea4538bcc0a64c7 to your computer and use it in GitHub Desktop.
Save gaboesquivel/9e10692179904e7c8ea4538bcc0a64c7 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