diff options
Diffstat (limited to 'frontend/__tests__/Pagination.test.js')
| -rw-r--r-- | frontend/__tests__/Pagination.test.js | 27 |
1 files changed, 22 insertions, 5 deletions
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('<Pagination/>', () => { - it('displays loading message', () => { - const wrapper = shallow(<Pagination loading page={1} itemsQuery={fakeQuery} />); - 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( + <MockedProvider mocks={mocks}> + <Pagination page={1} /> + </MockedProvider> + ); + console.log(wrapper.debug()); + // expect(toJSON(wrapper)).toMatchSnapshot(); }); it('renders pagination for 18 items', () => { |
