Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- _onSubmit = (event) => {
- event.preventDefault()
- const { username, password } = this.state
- this.props.createUserMutation({
- variables: { username, password }
- }).then(response => {
- this.setState({
- username: '',
- password: ''
- })
- }).catch(error => {
- console.warn(error)
- })
- }
- it('_onSubmit() should submit form and reset state object', () => {
- const wrapper = shallow(<CreateAccount />)
- wrapper.setState({ username: 'Username', password: 'Password' })
- wrapper.find(Form).simulate('submit', {
- preventDefault: () => {}
- })
- const state = wrapper.instance().state
- expect(state).toEqual({ username: '', password: '' })
- })
Add Comment
Please, Sign In to add comment