summaryrefslogtreecommitdiffstats
path: root/frontend/__tests__/Pagination.test.js
diff options
context:
space:
mode:
authorWes Bos <wesbos@gmail.com>2018-05-02 14:45:20 -0400
committerWes Bos <wesbos@gmail.com>2018-05-02 14:45:20 -0400
commitf02a5dc73ac4a14c1d641a6ddbfcd2f1bd2ea0b5 (patch)
tree514905bb030cb87fbbb686034f49e94b67b88853 /frontend/__tests__/Pagination.test.js
parentae6b07bce815a2dd21741a696eccc64c81587ef4 (diff)
TESTS
Diffstat (limited to 'frontend/__tests__/Pagination.test.js')
-rw-r--r--frontend/__tests__/Pagination.test.js27
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', () => {