From abe646cec868bf4093ccdf9140b34ea046688a29 Mon Sep 17 00:00:00 2001 From: Jeff Avallone Date: Thu, 15 Feb 2018 17:35:59 -0500 Subject: [PATCH] Adding tests for page components --- src/pages/404/Component.js | 1 + src/pages/404/Component.test.js | 14 ++++++ .../404/__snapshots__/Component.test.js.snap | 18 ++++++++ src/pages/index/Component.test.js | 13 ++++++ .../__snapshots__/Component.test.js.snap | 44 +++++++++++++++++++ 5 files changed, 90 insertions(+) create mode 100644 src/pages/404/Component.test.js create mode 100644 src/pages/404/__snapshots__/Component.test.js.snap create mode 100644 src/pages/index/Component.test.js create mode 100644 src/pages/index/__snapshots__/Component.test.js.snap diff --git a/src/pages/404/Component.js b/src/pages/404/Component.js index 23592b3..e9daf44 100644 --- a/src/pages/404/Component.js +++ b/src/pages/404/Component.js @@ -21,3 +21,4 @@ Component.propTypes = { }; export default translate()(Component); +export { Component }; diff --git a/src/pages/404/Component.test.js b/src/pages/404/Component.test.js new file mode 100644 index 0000000..cea772c --- /dev/null +++ b/src/pages/404/Component.test.js @@ -0,0 +1,14 @@ +import React from 'react'; +import { shallow } from 'enzyme'; + +import { translate } from 'i18n'; +import { Component } from './Component'; + +describe('404 page component', () => { + test('rendering', () => { + const component = shallow( + + ); + expect(component).toMatchSnapshot(); + }); +}); diff --git a/src/pages/404/__snapshots__/Component.test.js.snap b/src/pages/404/__snapshots__/Component.test.js.snap new file mode 100644 index 0000000..4bb002b --- /dev/null +++ b/src/pages/404/__snapshots__/Component.test.js.snap @@ -0,0 +1,18 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`404 page component rendering 1`] = ` + + + +

+ + The page you have requested could not be found + +

+
+ +
+`; diff --git a/src/pages/index/Component.test.js b/src/pages/index/Component.test.js new file mode 100644 index 0000000..f61ba93 --- /dev/null +++ b/src/pages/index/Component.test.js @@ -0,0 +1,13 @@ +import React from 'react'; +import { shallow } from 'enzyme'; + +import Component from './Component'; + +describe('Index page component', () => { + test('rendering', () => { + const component = shallow( + + ); + expect(component).toMatchSnapshot(); + }); +}); diff --git a/src/pages/index/__snapshots__/Component.test.js.snap b/src/pages/index/__snapshots__/Component.test.js.snap new file mode 100644 index 0000000..ddcc3de --- /dev/null +++ b/src/pages/index/__snapshots__/Component.test.js.snap @@ -0,0 +1,44 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Index page component rendering 1`] = ` + + + + + + +`;