diff --git a/src/components/FormActions/__snapshots__/test.js.snap b/src/components/FormActions/__snapshots__/test.js.snap
index e16f41c..b4bbe71 100644
--- a/src/components/FormActions/__snapshots__/test.js.snap
+++ b/src/components/FormActions/__snapshots__/test.js.snap
@@ -1,172 +1,196 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`FormActions rendering 1`] = `
-
+
+
+
`;
exports[`FormActions rendering download links 1`] = `
-
+
+
+
`;
exports[`FormActions rendering download links with data after mounting 1`] = `
-
+
+
+
`;
exports[`FormActions rendering download links with data after mounting 2`] = `
-
+
+
+
`;
exports[`FormActions rendering download links with data after mounting 3`] = `
-
+
+
+
`;
exports[`FormActions rendering with a permalink 1`] = `
-
+
+
+
`;
diff --git a/src/components/FormActions/test.js b/src/components/FormActions/test.js
index cb53f46..bb986b7 100644
--- a/src/components/FormActions/test.js
+++ b/src/components/FormActions/test.js
@@ -1,4 +1,10 @@
jest.mock('./links');
+jest.mock('react-feather/dist/icons/download', () =>
+ require('__mocks__/component-mock')(
+ 'react-feather/dist/icons/download'));
+jest.mock('react-feather/dist/icons/link', () =>
+ require('__mocks__/component-mock')(
+ 'react-feather/dist/icons/link'));
import React from 'react';
import { render } from 'react-testing-library';
@@ -21,68 +27,70 @@ createSvgLink.mockResolvedValue({
});
describe('FormActions', () => {
- test.skip('rendering', () => {
- const component = shallow(
+ test('rendering', () => {
+ const { asFragment } = render(
);
- expect(component).toMatchSnapshot();
+ expect(asFragment()).toMatchSnapshot();
});
- test.skip('rendering with a permalink', () => {
- const component = shallow(
+ test('rendering with a permalink', () => {
+ const { asFragment } = render(
);
- expect(component).toMatchSnapshot();
+ expect(asFragment()).toMatchSnapshot();
});
- test.skip('rendering download links', async () => {
+ test('rendering download links', async () => {
const imageDetails = {
svg: 'test image',
width: 10,
height: 20
};
- const component = shallow(
+ const { asFragment } = render(
);
// Give a beat for mocked promises to resolve
await new Promise(resolve => setTimeout(resolve));
- expect(component).toMatchSnapshot();
+ expect(asFragment()).toMatchSnapshot();
});
- test.skip('rendering download links with data after mounting', async () => {
- const component = shallow(
+ test('rendering download links with data after mounting', async () => {
+ const { asFragment, rerender } = render(
);
- component.setProps({ permalinkUrl: 'http://example.com' });
+ rerender(
+
+ );
- expect(component).toMatchSnapshot();
+ expect(asFragment()).toMatchSnapshot();
- component.setProps({
- imageDetails: {
- svg: 'test image'
- }
- });
+ rerender(
+
+ );
// Give a beat for mocked promises to resolve
await new Promise(resolve => setTimeout(resolve));
- expect(component).toMatchSnapshot();
+ expect(asFragment()).toMatchSnapshot();
- component.setProps({
- imageDetails: {
- svg: 'test image',
- width: 10,
- height: 20
- }
- });
+ rerender(
+
+ );
// Give a beat for mocked promises to resolve
await new Promise(resolve => setTimeout(resolve));
- expect(component).toMatchSnapshot();
+ expect(asFragment()).toMatchSnapshot();
});
});