From 5d700f47aaab34def4903d9cbfaaba7361cb852b Mon Sep 17 00:00:00 2001 From: Jeff Avallone Date: Sun, 24 Mar 2019 12:59:31 -0400 Subject: [PATCH] Updating 404 page to use react-testing-library --- src/pages/404.test.js | 11 ++++++--- src/pages/__snapshots__/404.test.js.snap | 29 ++++++++++++++++-------- 2 files changed, 27 insertions(+), 13 deletions(-) diff --git a/src/pages/404.test.js b/src/pages/404.test.js index 9ad5dbf..939135d 100644 --- a/src/pages/404.test.js +++ b/src/pages/404.test.js @@ -1,14 +1,19 @@ +jest.mock('components/Metadata', () => + require('__mocks__/component-mock')('components/Metadata')); +jest.mock('components/Message', () => + require('__mocks__/component-mock')('components/Message')); + import React from 'react'; -import { shallow } from 'enzyme'; +import { render } from 'react-testing-library'; import { mockT } from 'i18n'; import { ErrorPage } from 'pages/404'; describe('Error Page', () => { test('rendering', () => { - const component = shallow( + const { asFragment } = render( ); - expect(component).toMatchSnapshot(); + expect(asFragment()).toMatchSnapshot(); }); }); diff --git a/src/pages/__snapshots__/404.test.js.snap b/src/pages/__snapshots__/404.test.js.snap index 0bf48f1..43bfeea 100644 --- a/src/pages/__snapshots__/404.test.js.snap +++ b/src/pages/__snapshots__/404.test.js.snap @@ -1,19 +1,28 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Error Page rendering 1`] = ` - - + -

- + The page you have requested could not be found. - +

-
-
+ + `;