Created
June 22, 2017 23:30
-
-
Save PillowUnicorn/d2b9368ca71e849c1d5503ceae8a65a9 to your computer and use it in GitHub Desktop.
Jest test for React Components
This file contains hidden or 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-native'; | |
import React from 'react'; | |
import renderer from 'react-test-renderer'; | |
import { EnterLogin } from '../enter_login'; | |
test( 'EnterLogin view renders correctly', () => { | |
const tree = renderer.create( | |
<EnterLogin /> | |
).toJSON() | |
expect( tree ).toMatchSnapshot(); | |
} ); | |
test( 'EnterLogin view renders with invalid login credentials', () => { | |
const tree = renderer.create( | |
<EnterLogin | |
error="The email and password you entered did not match our records. Please try again!" | |
/> | |
).toJSON() | |
expect( tree ).toMatchSnapshot(); | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment