Created
April 7, 2018 14:10
-
-
Save azamatsmith/0960c1fcd625b879998f855250788831 to your computer and use it in GitHub Desktop.
Example test of a react native loading component with Enzyme and Jest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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