blob: dcb9ca8d6c09f527ccc7bbcb702d40b8e2afcdbd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
import React from 'react';
import { shallow, mount } from 'enzyme';
import toJSON from 'enzyme-to-json';
import CartCount from '../components/CartCount';
describe('<CartCount></CartCount>', () => {
it('renders okay', () => {
shallow(<CartCount count={10} />);
});
it('matches snapshot', () => {
const wrapper = shallow(<CartCount count={10} />);
expect(toJSON(wrapper)).toMatchSnapshot();
});
it('updates via props', () => {
const wrapper = mount(<CartCount count={50} />);
expect(toJSON(wrapper)).toMatchSnapshot();
wrapper.setProps({ count: 10 });
expect(toJSON(wrapper)).toMatchSnapshot();
});
});
|