diff options
| author | Wes Bos <wesbos@gmail.com> | 2018-04-19 14:43:48 -0400 |
|---|---|---|
| committer | Wes Bos <wesbos@gmail.com> | 2018-04-19 14:43:48 -0400 |
| commit | aaae57b7978ffd0038ad560d6c9a4e8cf064cb0d (patch) | |
| tree | 4801d87e50d4c20817d443f9a7cc2092c82386f4 /frontend/__tests__/Cart.test.js | |
| parent | e018f5482e550a49535f4df990d3bfc09128f5d8 (diff) | |
test test test
Diffstat (limited to 'frontend/__tests__/Cart.test.js')
| -rw-r--r-- | frontend/__tests__/Cart.test.js | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/frontend/__tests__/Cart.test.js b/frontend/__tests__/Cart.test.js index 2ee87a2..b62d0de 100644 --- a/frontend/__tests__/Cart.test.js +++ b/frontend/__tests__/Cart.test.js @@ -1,24 +1,16 @@ 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() {}, -}; +import mountOptions from './mockMang'; +import wait from 'waait'; +import Cart from '../components/Cart'; describe('<Cart/>', () => { - it('renders', () => { - const wrapper = shallow(<Cart currentUser={currentUser} />); - console.log(wrapper.first()); + it('renders', async () => { + const wrapper = mount(<Cart />, mountOptions); + await wait(); + wrapper.update(); + expect(toJSON(wrapper.find('header'))).toMatchSnapshot(); + expect(wrapper.find('CartItem')).toHaveLength(2); }); }); |
