Skip to content

Commit

Permalink
Merge pull request #10 from navjobs/bug/initial-values-validation
Browse files Browse the repository at this point in the history
Use jests native spy instead of sinon
  • Loading branch information
Zach Silveira committed Aug 14, 2017
2 parents 71d1db7 + 6be3b75 commit 4ac6660
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions tests/inputs.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
//Test that components with the prop `name` get passed errors and values
import React from 'react';
import { spy } from 'sinon';
import Form from '../src/form';
import { shallow } from 'enzyme';

Expand Down Expand Up @@ -111,7 +110,7 @@ test('Error is removed onChange if set before blurred', () => {
});

test('Form validates with valid initial values passed and onValues prop passed', () => {
const onValues = spy();
const onValues = jest.fn();
const wrapper = shallow(
<Form
rules={{ Awesome: 'required' }}
Expand All @@ -124,6 +123,6 @@ test('Form validates with valid initial values passed and onValues prop passed',
);
wrapper.find('.submit').simulate('click');
expect(wrapper.find(Input).props().error).toEqual('');
expect(onValues.calledOnce).toEqual(true);
expect(onValues.args[0][0].Awesome).toEqual('hello');
expect(onValues).toHaveBeenCalledTimes(1);
expect(onValues.mock.calls[0][0].Awesome).toEqual('hello');
});

0 comments on commit 4ac6660

Please sign in to comment.