diff --git a/src/components/Message/__snapshots__/test.js.snap b/src/components/Message/__snapshots__/test.js.snap index 123c105..7fb8652 100644 --- a/src/components/Message/__snapshots__/test.js.snap +++ b/src/components/Message/__snapshots__/test.js.snap @@ -1,99 +1,105 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Message rendering 1`] = ` -
+
-

- Testing -

+
+

+ Testing +

+
+
+

+ Message content +

+
-
-

- Message content -

-
-
+ `; exports[`Message rendering with a close button 1`] = ` -
+
-

- Testing -

- +

+ Testing +

+ +
+
+

+ Message content +

+
-
-

- Message content -

-
- + `; exports[`Message rendering with icon 1`] = ` -
+
- -

- Testing -

+
+ Sample icon SVG +

+ Testing +

+
+
+

+ Message content +

+
-
-

- Message content -

-
-
+ `; exports[`Message rendering with type 1`] = ` -
+
- -

- Testing -

+
+ +

+ Testing +

+
+
+

+ Message content +

+
-
-

- Message content -

-
-
+ `; diff --git a/src/components/Message/test.js b/src/components/Message/test.js index 348eae6..d77019b 100644 --- a/src/components/Message/test.js +++ b/src/components/Message/test.js @@ -1,43 +1,56 @@ +jest.mock('react-feather/dist/icons/info', () => + require('__mocks__/component-mock')('react-feather/dist/icons/info')); +jest.mock('react-feather/dist/icons/alert-octagon', () => + require('__mocks__/component-mock')( + 'react-feather/dist/icons/alert-octagon' + )); +jest.mock('react-feather/dist/icons/alert-triangle', () => + require('__mocks__/component-mock')( + 'react-feather/dist/icons/alert-triangle' + )); +jest.mock('react-feather/dist/icons/x-square', () => + require('__mocks__/component-mock')('react-feather/dist/icons/x-square')); + import React from 'react'; -import { shallow } from 'enzyme'; +import { render } from 'react-testing-library'; import Message from 'components/Message'; describe('Message', () => { test('rendering', () => { - const component = shallow( + const { asFragment } = render(

Message content

); - expect(component).toMatchSnapshot(); + expect(asFragment()).toMatchSnapshot(); }); test('rendering with icon', () => { const Icon = () => 'Sample icon SVG'; - const component = shallow( + const { asFragment } = render(

Message content

); - expect(component).toMatchSnapshot(); + expect(asFragment()).toMatchSnapshot(); }); test('rendering with type', () => { - const component = shallow( + const { asFragment } = render(

Message content

); - expect(component).toMatchSnapshot(); + expect(asFragment()).toMatchSnapshot(); }); test('rendering with a close button', () => { - const component = shallow( + const { asFragment } = render(

Message content

); - expect(component).toMatchSnapshot(); + expect(asFragment()).toMatchSnapshot(); }); });