From f02a5dc73ac4a14c1d641a6ddbfcd2f1bd2ea0b5 Mon Sep 17 00:00:00 2001 From: Wes Bos Date: Wed, 2 May 2018 14:45:20 -0400 Subject: TESTS --- frontend/__tests__/Pagination.test.js | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) (limited to 'frontend/__tests__/Pagination.test.js') diff --git a/frontend/__tests__/Pagination.test.js b/frontend/__tests__/Pagination.test.js index e2ef7af..c72dac2 100644 --- a/frontend/__tests__/Pagination.test.js +++ b/frontend/__tests__/Pagination.test.js @@ -1,16 +1,33 @@ import React from 'react'; import { shallow, mount } from 'enzyme'; import toJSON from 'enzyme-to-json'; -import { Pagination } from '../components/Pagination'; +import Pagination from '../components/Pagination'; +import { MockedProvider } from 'react-apollo/test-utils'; +import { fakeItem } from './mockMang'; +import { ALL_ITEMS_QUERY } from '../queries/queries'; -const fakeQuery = { +const data = { itemsConnection: { aggregate: { count: 18 } }, + items: [fakeItem()], }; describe('', () => { - it('displays loading message', () => { - const wrapper = shallow(); - expect(toJSON(wrapper)).toMatchSnapshot(); + fit('displays loading message', () => { + const mocks = [ + { + request: { query: ALL_ITEMS_QUERY, variables: { skip: 0 } }, + delay: 50, + result: { data }, + }, + ]; + + const wrapper = mount( + + + + ); + console.log(wrapper.debug()); + // expect(toJSON(wrapper)).toMatchSnapshot(); }); it('renders pagination for 18 items', () => { -- cgit v1.3