blob: 6786a86469fc5721a14a9f3a307ab4fd9a2a6311 (
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();
});
});
|