diff --git a/package.json b/package.json index 8fa8032..5436e3b 100644 --- a/package.json +++ b/package.json @@ -43,6 +43,7 @@ "prettier": "^2.3.2", "razzle": "^4.0.6", "razzle-dev-utils": "^4.0.6", + "react-test-renderer": "^17.0.2", "stylelint": "^13.13.1", "stylelint-config-prettier": "^8.0.2", "webpack": "^4.44.1", diff --git a/src/components/App/App.test.js b/src/components/App/__test__/App.test.js similarity index 54% rename from src/components/App/App.test.js rename to src/components/App/__test__/App.test.js index ca97c5e..778732f 100644 --- a/src/components/App/App.test.js +++ b/src/components/App/__test__/App.test.js @@ -1,7 +1,8 @@ -import App from './App'; +import App from '../App'; import React from 'react'; import ReactDOM from 'react-dom'; import { MemoryRouter } from 'react-router-dom'; +import renderer from 'react-test-renderer'; describe('', () => { test('renders without exploding', () => { @@ -13,4 +14,14 @@ describe('', () => { div, ); }); + test(' snapshot', () => { + const tree = renderer + .create( + + + , + ) + .toJSON(); + expect(tree).toMatchSnapshot(); + }); }); diff --git a/src/components/App/__test__/__snapshots__/App.test.js.snap b/src/components/App/__test__/__snapshots__/App.test.js.snap new file mode 100644 index 0000000..3fa9128 --- /dev/null +++ b/src/components/App/__test__/__snapshots__/App.test.js.snap @@ -0,0 +1,37 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[` snapshot 1`] = ` +
+
+
+
+ +

+ undefined +

+

+

+

+

+
+
+
+
+`; diff --git a/src/components/Avatar/Avatar.test.js b/src/components/Avatar/__test__/Avatar.test.js similarity index 52% rename from src/components/Avatar/Avatar.test.js rename to src/components/Avatar/__test__/Avatar.test.js index 4513a59..dd44a2c 100644 --- a/src/components/Avatar/Avatar.test.js +++ b/src/components/Avatar/__test__/Avatar.test.js @@ -1,10 +1,15 @@ -import Avatar from './Avatar'; +import Avatar from '../Avatar'; import React from 'react'; import ReactDOM from 'react-dom'; +import renderer from 'react-test-renderer'; describe('', () => { test('renders without exploding', () => { const div = document.createElement('div'); ReactDOM.render(, div); }); + test(' snapshot', () => { + const tree = renderer.create().toJSON(); + expect(tree).toMatchSnapshot(); + }); }); diff --git a/src/components/Avatar/__test__/__snapshots__/Avatar.test.js.snap b/src/components/Avatar/__test__/__snapshots__/Avatar.test.js.snap new file mode 100644 index 0000000..493c7b1 --- /dev/null +++ b/src/components/Avatar/__test__/__snapshots__/Avatar.test.js.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[` snapshot 1`] = ` + +`; diff --git a/src/components/Button/Button.test.js b/src/components/Button/__test__/Button.test.js similarity index 52% rename from src/components/Button/Button.test.js rename to src/components/Button/__test__/Button.test.js index 893e441..cbbfed3 100644 --- a/src/components/Button/Button.test.js +++ b/src/components/Button/__test__/Button.test.js @@ -1,10 +1,15 @@ -import Button from './Button'; +import Button from '../Button'; import React from 'react'; import ReactDOM from 'react-dom'; +import renderer from 'react-test-renderer'; describe('