Skip to content

Instantly share code, notes, and snippets.

@thomashagstrom
Created January 13, 2019 12:10
Show Gist options
  • Save thomashagstrom/39b93ce246aee869f3e66329c7d1922e to your computer and use it in GitHub Desktop.
Save thomashagstrom/39b93ce246aee869f3e66329c7d1922e to your computer and use it in GitHub Desktop.
Jest set React component state
const wrapper = TestRenderer.create(<CognitoLogin />);
const state: ICognitoLoginState = {
formState: 'Register',
code: 'testcode',
userInput: { email: 'bogus@test.com', password: 'testPw' },
result: undefined,
};
wrapper.root.instance.setState(state);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment