summaryrefslogtreecommitdiffstats
path: root/frontend/__tests__/CartCount.test.js
blob: f3c49780ce2f076e0b5bf4c86da5e325df0d73b0 (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();
  });
});