diff options
Diffstat (limited to 'frontend/__tests__')
| -rw-r--r-- | frontend/__tests__/Cart.test.js | 15 | ||||
| -rw-r--r-- | frontend/__tests__/__snapshots__/Cart.test.js.snap | 44 |
2 files changed, 51 insertions, 8 deletions
diff --git a/frontend/__tests__/Cart.test.js b/frontend/__tests__/Cart.test.js index 0936e97..1e7d7f5 100644 --- a/frontend/__tests__/Cart.test.js +++ b/frontend/__tests__/Cart.test.js @@ -2,6 +2,7 @@ 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 }, @@ -17,14 +18,12 @@ const currentUser = { describe('<Cart/>', () => { it('renders', () => { - const wrapper = shallow(<Cart currentUser={currentUser} />); - }); + const wrapper = mount( + <UIProvider> + <Cart currentUser={currentUser} /> + </UIProvider> + ); - xit('opens', () => { - const wrapper = shallow(<Cart currentUser={currentUser} />); - expect('wes').toEqual('figure out how to call test context'); + expect(toJSON(wrapper)).toMatchSnapshot(); }); - // it('renders', () => { - // shallow(<Cart currentUser={currentUserLoggedOut} />); - // }); }); diff --git a/frontend/__tests__/__snapshots__/Cart.test.js.snap b/frontend/__tests__/__snapshots__/Cart.test.js.snap new file mode 100644 index 0000000..b2b6bc7 --- /dev/null +++ b/frontend/__tests__/__snapshots__/Cart.test.js.snap @@ -0,0 +1,44 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`<Cart/> renders 1`] = ` +<[object Object] + value={ + Object { + "state": Object { + "isCartOpen": false, + }, + "toggle": [Function], + } + } +> + <Cart + currentUser={ + Object { + "me": Object { + "cart": Array [ + Object { + "item": Object { + "price": 5000, + }, + "quantity": 10, + }, + Object { + "item": Object { + "price": 5000, + }, + "quantity": 10, + }, + Object { + "item": Object { + "price": 5000, + }, + "quantity": 10, + }, + ], + }, + "refetch": [Function], + } + } + /> +</[object Object]> +`; |
