Skip to content

Instantly share code, notes, and snippets.

@thomashagstrom
Last active January 15, 2019 16:57
Show Gist options
  • Save thomashagstrom/5e20985588231f5117602952613c21b2 to your computer and use it in GitHub Desktop.
Save thomashagstrom/5e20985588231f5117602952613c21b2 to your computer and use it in GitHub Desktop.
Call async function in Jest test
it('Error label should contain `No userPool`', async () => {
const wrapper = TestRenderer.create(<CognitoLogin />);
const child = wrapper.root.findByProps({ iconName: 'sign-in' });
await child.props.onPress();
const errorLabel = wrapper.root.findByProps({ isCaption: true });
expect(errorLabel.props.children).toBe('No userPool');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment