diff --git a/src/components/Metadata/__snapshots__/test.js.snap b/src/components/Metadata/__snapshots__/test.js.snap index 7f02a3f..ca8e43b 100644 --- a/src/components/Metadata/__snapshots__/test.js.snap +++ b/src/components/Metadata/__snapshots__/test.js.snap @@ -1,37 +1,39 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Metadata rendering 1`] = ` - + - - Regexper - - +}" + > + + Regexper + + + `; exports[`Metadata rendering with a title and description 1`] = ` - + - - Regexper - Testing - - - +}" + > + + Regexper - Testing + + + + `; diff --git a/src/components/Metadata/test.js b/src/components/Metadata/test.js index b7f3cdf..89c4d29 100644 --- a/src/components/Metadata/test.js +++ b/src/components/Metadata/test.js @@ -1,5 +1,13 @@ +jest.mock('react-helmet', () => { + const helmet = jest.requireActual('react-helmet'); + return { + ...helmet, + Helmet: require('__mocks__/component-mock').buildMock(helmet.Helmet) + }; +}); + import React from 'react'; -import { shallow } from 'enzyme'; +import { render } from 'react-testing-library'; import { Metadata } from 'components/Metadata'; @@ -9,19 +17,19 @@ const commonProps = { describe('Metadata', () => { test('rendering', () => { - const component = shallow( + const { asFragment } = render( ); - expect(component).toMatchSnapshot(); + expect(asFragment()).toMatchSnapshot(); }); test('rendering with a title and description', () => { - const component = shallow( + const { asFragment } = render( ); - expect(component).toMatchSnapshot(); + expect(asFragment()).toMatchSnapshot(); }); });