diff options
Diffstat (limited to 'frontend/__tests__')
12 files changed, 34 insertions, 20 deletions
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('<CartCount></CartCount>', () => { it('renders okay', () => { - shallow(<CartCount count="10" />); + shallow(<CartCount count={10} />); }); it('matches snapshot', () => { - const wrapper = shallow(<CartCount count="10" />); + const wrapper = shallow(<CartCount count={10} />); expect(toJSON(wrapper)).toMatchSnapshot(); }); it('updates via props', () => { - const wrapper = mount(<CartCount count="50" />); + const wrapper = mount(<CartCount count={50} />); 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('<PleaseSignIn />', () => { it('renders sign in dialog to logged out users', async () => { const wrapper = mount( <MockedProvider mocks={notSignedInMocks}> - <PleaseSignIn> + <PleaseSignIn allowedPermissions={[]}> <Hey /> </PleaseSignIn> </MockedProvider> 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[`<Cart/> renders 1`] = ` title="close" > <button - className="sc-bZQynM julgib" + className="sc-EHOje jytiuo" onClick={[Function]} title="close" > @@ -16,7 +16,7 @@ exports[`<Cart/> renders 1`] = ` </styled.button> <styled.h3> <h3 - className="sc-EHOje ixXoOG" + className="sc-ifAKCX imryuh" > Miss Coleman Berge 's Cart. diff --git a/frontend/__tests__/__snapshots__/CartCount.test.js.snap b/frontend/__tests__/__snapshots__/CartCount.test.js.snap index 7c647f4..224141b 100644 --- a/frontend/__tests__/__snapshots__/CartCount.test.js.snap +++ b/frontend/__tests__/__snapshots__/CartCount.test.js.snap @@ -28,7 +28,7 @@ exports[`<CartCount></CartCount> matches snapshot 1`] = ` exports[`<CartCount></CartCount> updates via props 1`] = ` <CartCount - count="50" + count={50} > <styled.span> <span diff --git a/frontend/__tests__/__snapshots__/CreateItem.test.js.snap b/frontend/__tests__/__snapshots__/CreateItem.test.js.snap index 5c51c2d..89dbcd2 100644 --- a/frontend/__tests__/__snapshots__/CreateItem.test.js.snap +++ b/frontend/__tests__/__snapshots__/CreateItem.test.js.snap @@ -9,21 +9,28 @@ exports[`<Createitem/> renders and matches snapshot 1`] = ` <h2> Sell an Item. </h2> - <DisplayError /> + <DisplayError + error={Object {}} + /> <fieldset aria-busy={false} disabled={false} > - <label> + <label + htmlFor="file" + > Image <input accept=".png, .jpg, .jpeg" + id="file" onChange={[Function]} required={true} type="file" /> </label> - <label> + <label + htmlFor="title" + > Title <input id="title" @@ -35,7 +42,9 @@ exports[`<Createitem/> renders and matches snapshot 1`] = ` value="" /> </label> - <label> + <label + htmlFor="price" + > Price 0 <input diff --git a/frontend/__tests__/__snapshots__/EditUser.test.js.snap b/frontend/__tests__/__snapshots__/EditUser.test.js.snap index 8a39758..bbb672d 100644 --- a/frontend/__tests__/__snapshots__/EditUser.test.js.snap +++ b/frontend/__tests__/__snapshots__/EditUser.test.js.snap @@ -5,7 +5,9 @@ exports[`<EditUser/> renders 1`] = ` className="sc-bdVaJa LHejR" onSubmit={[Function]} > - <DisplayError /> + <DisplayError + error={Object {}} + /> <fieldset aria-busy={false} disabled={false} diff --git a/frontend/__tests__/__snapshots__/Pagination.test.js.snap b/frontend/__tests__/__snapshots__/Pagination.test.js.snap index 2ecd98a..ed10448 100644 --- a/frontend/__tests__/__snapshots__/Pagination.test.js.snap +++ b/frontend/__tests__/__snapshots__/Pagination.test.js.snap @@ -14,6 +14,7 @@ exports[`<Pagination/> displays loading message 1`] = ` }, } } + prefetch={true} > <a aria-disabled={true} @@ -52,6 +53,7 @@ exports[`<Pagination/> displays loading message 1`] = ` }, } } + prefetch={true} > <a aria-disabled={true} diff --git a/frontend/__tests__/__snapshots__/RemoveFromCart.test.js.snap b/frontend/__tests__/__snapshots__/RemoveFromCart.test.js.snap index f982011..a80b678 100644 --- a/frontend/__tests__/__snapshots__/RemoveFromCart.test.js.snap +++ b/frontend/__tests__/__snapshots__/RemoveFromCart.test.js.snap @@ -3,6 +3,7 @@ exports[`<RemoveFromCart/> renders and matches snapshot 1`] = ` <button className="sc-bdVaJa fXnNqM" + disabled={false} onClick={[Function]} title="Remove From Cart" > diff --git a/frontend/__tests__/__snapshots__/ResetRequest.test.js.snap b/frontend/__tests__/__snapshots__/ResetRequest.test.js.snap index f93486b..a6a0375 100644 --- a/frontend/__tests__/__snapshots__/ResetRequest.test.js.snap +++ b/frontend/__tests__/__snapshots__/ResetRequest.test.js.snap @@ -6,7 +6,9 @@ exports[`<ResetRequest/> renders and matches snapshot 1`] = ` data-test="ResetRequest" onSubmit={[Function]} > - <DisplayError /> + <DisplayError + error={Object {}} + /> <fieldset aria-busy={false} disabled={false} diff --git a/frontend/__tests__/__snapshots__/Signup.test.js.snap b/frontend/__tests__/__snapshots__/Signup.test.js.snap index d4d88a1..536c1d8 100644 --- a/frontend/__tests__/__snapshots__/Signup.test.js.snap +++ b/frontend/__tests__/__snapshots__/Signup.test.js.snap @@ -9,7 +9,9 @@ exports[`<Signup/> renders and matches snapshot 1`] = ` aria-busy={false} disabled={false} > - <DisplayError /> + <DisplayError + error={Object {}} + /> <h2> Sign Up for an Account </h2> diff --git a/frontend/__tests__/__snapshots__/SingleItem.test.js.snap b/frontend/__tests__/__snapshots__/SingleItem.test.js.snap index 4d75565..0969d73 100644 --- a/frontend/__tests__/__snapshots__/SingleItem.test.js.snap +++ b/frontend/__tests__/__snapshots__/SingleItem.test.js.snap @@ -8,9 +8,6 @@ exports[`<SingleItem/> Errors with a not found Item 1`] = ` Shoot! </strong> Item not found! - <button> - Try Again - </button> </p> `; |
