From 8ccb0d93cdc064776454c929e15aa03129be37a3 Mon Sep 17 00:00:00 2001 From: Wes Bos Date: Fri, 11 May 2018 10:46:24 -0400 Subject: clean up --- frontend/__tests__/CartCount.test.js | 6 +++--- frontend/__tests__/Pagination.test.js | 5 ++--- frontend/__tests__/PleaseSignIn.test.js | 2 +- frontend/__tests__/__snapshots__/Cart.test.js.snap | 4 ++-- frontend/__tests__/__snapshots__/CartCount.test.js.snap | 2 +- .../__tests__/__snapshots__/CreateItem.test.js.snap | 17 +++++++++++++---- frontend/__tests__/__snapshots__/EditUser.test.js.snap | 4 +++- .../__tests__/__snapshots__/Pagination.test.js.snap | 2 ++ .../__tests__/__snapshots__/RemoveFromCart.test.js.snap | 1 + .../__tests__/__snapshots__/ResetRequest.test.js.snap | 4 +++- frontend/__tests__/__snapshots__/Signup.test.js.snap | 4 +++- .../__tests__/__snapshots__/SingleItem.test.js.snap | 3 --- 12 files changed, 34 insertions(+), 20 deletions(-) (limited to 'frontend/__tests__') diff --git a/frontend/__tests__/CartCount.test.js b/frontend/__tests__/CartCount.test.js index 6786a86..dcb9ca8 100644 --- a/frontend/__tests__/CartCount.test.js +++ b/frontend/__tests__/CartCount.test.js @@ -5,15 +5,15 @@ import CartCount from '../components/CartCount'; describe('', () => { it('renders okay', () => { - shallow(); + shallow(); }); it('matches snapshot', () => { - const wrapper = shallow(); + const wrapper = shallow(); expect(toJSON(wrapper)).toMatchSnapshot(); }); it('updates via props', () => { - const wrapper = mount(); + const wrapper = mount(); expect(toJSON(wrapper)).toMatchSnapshot(); wrapper.setProps({ count: 10 }); expect(toJSON(wrapper)).toMatchSnapshot(); diff --git a/frontend/__tests__/Pagination.test.js b/frontend/__tests__/Pagination.test.js index 6be60c1..1dbc7b4 100644 --- a/frontend/__tests__/Pagination.test.js +++ b/frontend/__tests__/Pagination.test.js @@ -9,7 +9,8 @@ import { ALL_ITEMS_QUERY } from '../queries/queries'; import Router from 'next/router'; -Router.router = { push() {} }; +// mock the router because there isn't really a router instance +Router.router = { push() {}, prefetch() {} }; function makeMocksFor(length) { return [ @@ -18,14 +19,12 @@ function makeMocksFor(length) { result: { data: { itemsConnection: { - // TODO what are these typenames ???? __typename: 'aggregate', aggregate: { count: length, __typename: 'count', }, }, - // items: [fakeItem()], items: Array.from({ length }, (_, i) => fakeItem({ id: `item${i}` })), }, }, diff --git a/frontend/__tests__/PleaseSignIn.test.js b/frontend/__tests__/PleaseSignIn.test.js index ea5b6d7..5a5a856 100644 --- a/frontend/__tests__/PleaseSignIn.test.js +++ b/frontend/__tests__/PleaseSignIn.test.js @@ -37,7 +37,7 @@ describe('', () => { it('renders sign in dialog to logged out users', async () => { const wrapper = mount( - + diff --git a/frontend/__tests__/__snapshots__/Cart.test.js.snap b/frontend/__tests__/__snapshots__/Cart.test.js.snap index 28011dc..9aeedfd 100644 --- a/frontend/__tests__/__snapshots__/Cart.test.js.snap +++ b/frontend/__tests__/__snapshots__/Cart.test.js.snap @@ -7,7 +7,7 @@ exports[` renders 1`] = ` title="close" >

`; -- cgit v1.3