Guest User

Untitled

a guest
Mar 21st, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. import React from 'react';
  2. import { shallow } from 'enzyme';
  3.  
  4. import Card from './';
  5.  
  6. describe('test Card component', () => {
  7. it('should render the component', () => {
  8. const enzymeWrapper = shallow(<Card />);
  9.  
  10. expect(enzymeWrapper).toHaveLength(1);
  11. });
  12.  
  13. it('state should change when salute button gets clicked', () => {
  14. const enzymeWrapper = shallow(<Card />);
  15.  
  16. expect(enzymeWrapper.state('salute')).toBeFalsy();
  17.  
  18. enzymeWrapper.find('button').at(0).simulate('click');
  19.  
  20. expect(enzymeWrapper.state('salute')).toBeTruthy();
  21. expect(enzymeWrapper.find('button').at(0).text()).toEqual(
  22. 'You said hi',
  23. );
  24. });
  25. });
Add Comment
Please, Sign In to add comment