summaryrefslogtreecommitdiffstats
path: root/frontend/__tests__/Cart.test.js
blob: 1e7d7f536fb550f943daa8bc8bb0faf70030b2c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import React from 'react';
import { shallow, mount } from 'enzyme';
import toJSON from 'enzyme-to-json';
import { Cart } from '../components/Cart';
import { UIProvider } from '../components/UIContext';

const cartItem = {
  item: { price: 5000 },
  quantity: 10,
};

const currentUser = {
  me: {
    cart: [cartItem, cartItem, cartItem],
  },
  refetch() {},
};

describe('<Cart/>', () => {
  it('renders', () => {
    const wrapper = mount(
      <UIProvider>
        <Cart currentUser={currentUser} />
      </UIProvider>
    );

    expect(toJSON(wrapper)).toMatchSnapshot();
  });
});