Skip to content

Instantly share code, notes, and snippets.

@kaievns
Created December 7, 2017 05:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kaievns/320cfaeec7a45e3df9e0d77604a55808 to your computer and use it in GitHub Desktop.
Save kaievns/320cfaeec7a45e3df9e0d77604a55808 to your computer and use it in GitHub Desktop.
import { mount } from 'enzyme';
import { TextInput, PasswordInput } from 'a-plus-forms';
import SignInForm from 'src/features/auth/signin_form';
describe('<SignInForm /', () => {
it('works beautifully', () => {
const onSubmit = sinon.spy();
const wrapper = mount(<SignInForm onSubmit={onSubmit} />);
wrapper.find(TextInput).instance().value = 'nikolay';
wrapper.find(PasswordInput).instance().value = 'b@(k0n!';
wrapper.find('form').simulate('submit');
expect(onSubmit).to.have.been.calledWith({
username: 'nikolay', password: 'b@(k0n!'
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment