From 92f612a995c54f7423bd2b760fb1a324044693a6 Mon Sep 17 00:00:00 2001 From: Wes Bos Date: Tue, 20 Mar 2018 14:48:34 -0400 Subject: Starting testing --- frontend/__tests__/Cart.test.js | 15 ++++---- frontend/__tests__/__snapshots__/Cart.test.js.snap | 44 ++++++++++++++++++++++ 2 files changed, 51 insertions(+), 8 deletions(-) create mode 100644 frontend/__tests__/__snapshots__/Cart.test.js.snap (limited to 'frontend') 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('', () => { it('renders', () => { - const wrapper = shallow(); - }); + const wrapper = mount( + + + + ); - xit('opens', () => { - const wrapper = shallow(); - expect('wes').toEqual('figure out how to call test context'); + expect(toJSON(wrapper)).toMatchSnapshot(); }); - // it('renders', () => { - // shallow(); - // }); }); 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[` renders 1`] = ` +<[object Object] + value={ + Object { + "state": Object { + "isCartOpen": false, + }, + "toggle": [Function], + } + } +> + + +`; -- cgit v1.3