Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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',
- );
- });
- });
Add Comment
Please, Sign In to add comment