Skip to content

Instantly share code, notes, and snippets.

@azamatsmith
Created April 7, 2018 14:10
Show Gist options
  • Save azamatsmith/0960c1fcd625b879998f855250788831 to your computer and use it in GitHub Desktop.
Save azamatsmith/0960c1fcd625b879998f855250788831 to your computer and use it in GitHub Desktop.
Example test of a react native loading component with Enzyme and Jest
import React from 'react';
import {shallow} from 'enzyme';
import Loading from './';
describe('<Loading />', () => {
const notLoadingWrapper = shallow(<Loading loading={false} />);
const defaultWrapper = shallow(<Loading />);
it('renders without crashing', () => {
expect(defaultWrapper.find('View').length).not.toEqual(0);
});
it('should return null when loading is false', () => {
expect(notLoadingWrapper).not.toEqual(null);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment