From ace907779fbe3a9ae1d1c1371d42c975623bc43f Mon Sep 17 00:00:00 2001 From: Jeff Avallone Date: Sun, 24 Mar 2019 13:06:11 -0400 Subject: [PATCH] Updating Layout to use react-testing-library --- .../Layout/__snapshots__/test.js.snap | 46 ++++++++++--------- src/components/Layout/test.js | 13 ++++-- 2 files changed, 35 insertions(+), 24 deletions(-) diff --git a/src/components/Layout/__snapshots__/test.js.snap b/src/components/Layout/__snapshots__/test.js.snap index 27a00b1..7f80226 100644 --- a/src/components/Layout/__snapshots__/test.js.snap +++ b/src/components/Layout/__snapshots__/test.js.snap @@ -1,26 +1,30 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Layout rendering 1`] = ` - - - - - Example content - - - + Example content + + + + `; diff --git a/src/components/Layout/test.js b/src/components/Layout/test.js index 9ecec6c..8654862 100644 --- a/src/components/Layout/test.js +++ b/src/components/Layout/test.js @@ -1,15 +1,22 @@ +jest.mock('components/SentryBoundary', () => + require('__mocks__/component-mock')('components/SentryBoundary')); +jest.mock('components/Header', () => + require('__mocks__/component-mock')('components/Header')); +jest.mock('components/Footer', () => + require('__mocks__/component-mock')('components/Footer')); + import React from 'react'; -import { shallow } from 'enzyme'; +import { render } from 'react-testing-library'; import { Layout } from 'components/Layout'; describe('Layout', () => { test('rendering', () => { - const component = shallow( + const { asFragment } = render( Example content ); - expect(component).toMatchSnapshot(); + expect(asFragment()).toMatchSnapshot(); }); });