Last active
March 13, 2018 10:28
-
-
Save fakiolinho/4132c6216eca6d75849a7634f20fd3cc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { shallow } from 'enzyme'; | |
import Card from './'; | |
describe('test Card component', () => { | |
it('should render the component', () => { | |
const enzymeWrapper = shallow(<Card />); | |
expect(enzymeWrapper).toHaveLength(1); | |
}); | |
it('state should change when salute button gets clicked', () => { | |
const enzymeWrapper = shallow(<Card />); | |
expect(enzymeWrapper.state('salute')).toBeFalsy(); | |
enzymeWrapper.find('button').at(0).simulate('click'); | |
expect(enzymeWrapper.state('salute')).toBeTruthy(); | |
expect(enzymeWrapper.find('button').at(0).text()).toEqual( | |
'You said hi', | |
); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment