Skip to content

Instantly share code, notes, and snippets.

@bruceharris
Last active March 2, 2018 15:51
Show Gist options
  • Save bruceharris/dae58244e4d9a2e87fdc9284396f117f to your computer and use it in GitHub Desktop.
Save bruceharris/dae58244e4d9a2e87fdc9284396f117f to your computer and use it in GitHub Desktop.
React Unit Testing Example 2
import React from 'react';
import { mount } from 'enzyme';
import LoadingIndicator from './LoadingIndicator'
describe('LoadingIndicator', () => {
describe('when isLoading is false', () => {
it('should render children', () => {
const wrapper = mount(
<LoadingIndicator isLoading={false}>
<div>ahoy!</div>
</LoadingIndicator>
);
expect(wrapper.html()).toEqual('<div>ahoy!</div>');
wrapper.unmount();
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment