Skip to content

Instantly share code, notes, and snippets.

@thomashagstrom
Created January 14, 2019 07:55
Show Gist options
  • Save thomashagstrom/b13fa9456d6b3ec55a8bb3d1c076ab9d to your computer and use it in GitHub Desktop.
Save thomashagstrom/b13fa9456d6b3ec55a8bb3d1c076ab9d to your computer and use it in GitHub Desktop.
Test React component function
it('`onEmailChanged` should update state', () => {
const wrapper = TestRenderer.create(<CognitoLogin />);
const expectedEmail = 'bogus@stuff.com';
wrapper.root.instance.onEmailChanged(expectedEmail);
expect(wrapper.root.instance.state.userInput.email).toBe(expectedEmail);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment