From 54dd0e29830f04c9055863fb0449ee4fc2ab0689 Mon Sep 17 00:00:00 2001 From: Wes Bos Date: Tue, 17 Apr 2018 16:51:09 -0400 Subject: these tests are on fireee but the bad kind --- frontend/__tests__/SingleItem.test.js | 40 +++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 16 deletions(-) (limited to 'frontend/__tests__/SingleItem.test.js') diff --git a/frontend/__tests__/SingleItem.test.js b/frontend/__tests__/SingleItem.test.js index e39431d..313784e 100644 --- a/frontend/__tests__/SingleItem.test.js +++ b/frontend/__tests__/SingleItem.test.js @@ -1,23 +1,31 @@ import React from 'react'; -import { shallow } from 'enzyme'; +import { shallow, mount } from 'enzyme'; +import wait from 'waait'; import toJSON from 'enzyme-to-json'; -import { SingleItem } from '../components/SingleItem'; +import SingleItem from '../components/SingleItem'; +import { ApolloProvider } from 'react-apollo'; +import mockClient from './mockMang'; +import { SINGLE_ITEM_QUERY } from '../queries/queries'; -const wait = amount => new Promise(resolve => setTimeout(resolve, amount)); +describe('', () => { + it('Renders with Proper Data', async () => { + const wrapper = mount( + + + + ); + await wait(); + wrapper.update(); -const findItem = { - items: [ - { - largeImage: 'dog.jpg', - title: 'Sneakers', - description: 'A cool set of shoes', - }, - ], -}; + const Item = wrapper.find('[data-test="SingleItem"]'); + expect(toJSON(Item)).toMatchSnapshot(); + }); -describe('', () => { - it('renders', () => { - const wrapper = shallow(); - expect(toJSON(wrapper)).toMatchSnapshot(); + it('Errors with a not found Item', async () => { + const wrapper = mount( + + + + ); }); }); -- cgit v1.3