From 33f94810bea0232c9e1f4d254086a66555264f90 Mon Sep 17 00:00:00 2001 From: Amanda Muniz Date: Wed, 7 Apr 2021 23:13:27 -0300 Subject: [PATCH 1/5] [#155] Adding components tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Amanda Muniz Co-authored-by: Letícia Araujo --- app/src/tests/components/Snackbar.test.js | 20 +++++++++++++++++++ app/src/tests/components/StoryList.test.js | 23 ++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 app/src/tests/components/Snackbar.test.js create mode 100644 app/src/tests/components/StoryList.test.js diff --git a/app/src/tests/components/Snackbar.test.js b/app/src/tests/components/Snackbar.test.js new file mode 100644 index 0000000..8a53b72 --- /dev/null +++ b/app/src/tests/components/Snackbar.test.js @@ -0,0 +1,20 @@ +import React from 'react'; +import Snackbar from '../../components/Snackbar'; +import Adapter from 'enzyme-adapter-react-16'; +import renderer from 'react-test-renderer'; +import Enzyme from 'enzyme'; +import { Provider } from 'react-redux' +import { createStore } from "redux"; + +Enzyme.configure({ adapter: new Adapter() }); + +it('renders correctly', () => { + const tree = renderer + .create( jest.fn()} + />) + .toJSON(); + expect(tree).toMatchSnapshot(); +}); \ No newline at end of file diff --git a/app/src/tests/components/StoryList.test.js b/app/src/tests/components/StoryList.test.js new file mode 100644 index 0000000..1b5910a --- /dev/null +++ b/app/src/tests/components/StoryList.test.js @@ -0,0 +1,23 @@ +import React from 'react'; +import StoryList from '../../components/StoryList'; +import Adapter from 'enzyme-adapter-react-16'; +import renderer from 'react-test-renderer'; +import Enzyme from 'enzyme'; +import { Provider } from 'react-redux' +import { createStore } from "redux"; +import storyReducer from '../../ducks/stories' + + +Enzyme.configure({ adapter: new Adapter() }); + +it('renders correctly', () => { + const store = createStore(storyReducer); + const tree = renderer + .create( jest.fn()} + undo_delete = {false} + handleSnackbarClick = {() => jest.fn()} + />) + expect(tree).toMatchSnapshot(); + .toJSON(); +)}); \ No newline at end of file From e3b2c877265ed912dcdb3f7134a9c5923e901b3e Mon Sep 17 00:00:00 2001 From: Amanda Muniz Date: Thu, 8 Apr 2021 12:59:25 -0300 Subject: [PATCH 2/5] [#155] - Adding Snackbar test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Amanda Muniz Co-authored-by: Letícia Araujo --- app/src/tests/components/Snackbar.test.js | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/app/src/tests/components/Snackbar.test.js b/app/src/tests/components/Snackbar.test.js index 8a53b72..9e1b78f 100644 --- a/app/src/tests/components/Snackbar.test.js +++ b/app/src/tests/components/Snackbar.test.js @@ -1,20 +1,13 @@ -import React from 'react'; -import Snackbar from '../../components/Snackbar'; +import MessageSnackbar from '../../components/Snackbar'; import Adapter from 'enzyme-adapter-react-16'; -import renderer from 'react-test-renderer'; import Enzyme from 'enzyme'; -import { Provider } from 'react-redux' -import { createStore } from "redux"; Enzyme.configure({ adapter: new Adapter() }); -it('renders correctly', () => { - const tree = renderer - .create( jest.fn()} - />) - .toJSON(); - expect(tree).toMatchSnapshot(); -}); \ No newline at end of file +describe('Testing SnackBar', () => { + + it('should render as expected', function() { + const tree = MessageSnackbar({notification_text: 'test'}, {handleClose: () => jest.fn()}, {variant: "success" }); + expect(tree).toMatchSnapshot(); + }); + }); \ No newline at end of file From 6bc9de52c35d9e76d9da53da06b85a9d38e2cfb3 Mon Sep 17 00:00:00 2001 From: Leticia Araujo Date: Thu, 8 Apr 2021 13:21:29 -0300 Subject: [PATCH 3/5] [#155] Addition of tests Co-authored-by: Leticia Araujo Co-authored-by: Amanda Muniz --- app/src/tests/components/StoryList.test.js | 23 ------------------- .../tests/components/StorySnackBar.test.js | 13 +++++++++++ 2 files changed, 13 insertions(+), 23 deletions(-) delete mode 100644 app/src/tests/components/StoryList.test.js create mode 100644 app/src/tests/components/StorySnackBar.test.js diff --git a/app/src/tests/components/StoryList.test.js b/app/src/tests/components/StoryList.test.js deleted file mode 100644 index 1b5910a..0000000 --- a/app/src/tests/components/StoryList.test.js +++ /dev/null @@ -1,23 +0,0 @@ -import React from 'react'; -import StoryList from '../../components/StoryList'; -import Adapter from 'enzyme-adapter-react-16'; -import renderer from 'react-test-renderer'; -import Enzyme from 'enzyme'; -import { Provider } from 'react-redux' -import { createStore } from "redux"; -import storyReducer from '../../ducks/stories' - - -Enzyme.configure({ adapter: new Adapter() }); - -it('renders correctly', () => { - const store = createStore(storyReducer); - const tree = renderer - .create( jest.fn()} - undo_delete = {false} - handleSnackbarClick = {() => jest.fn()} - />) - expect(tree).toMatchSnapshot(); - .toJSON(); -)}); \ No newline at end of file diff --git a/app/src/tests/components/StorySnackBar.test.js b/app/src/tests/components/StorySnackBar.test.js new file mode 100644 index 0000000..ed39551 --- /dev/null +++ b/app/src/tests/components/StorySnackBar.test.js @@ -0,0 +1,13 @@ +import MessageSnackbar from '../../components/StorySnackbar'; +import Adapter from 'enzyme-adapter-react-16'; +import Enzyme from 'enzyme'; + +Enzyme.configure({ adapter: new Adapter() }); + +describe('Testing StorySnackBar', () => { + + it('should render as expected', function() { + const tree = MessageSnackbar({notification_text: 'test'}, {handleClose: () => jest.fn()}, {variant: "success" }); + expect(tree).toMatchSnapshot(); + }); + }); \ No newline at end of file From a17ee74dfb1bbbd19cfde8cd9aff6f68b195c093 Mon Sep 17 00:00:00 2001 From: Amanda Muniz Date: Thu, 8 Apr 2021 14:20:58 -0300 Subject: [PATCH 4/5] [#155] - Adding pages and styles tests Co-authored-by: Amanda Muniz Co-authored-by: Leticia Araujo --- app/src/tests/pages/App.test.js | 13 +++++++++++++ app/src/tests/pages/IntentPage.test.js | 13 +++++++++++++ app/src/tests/pages/StoriesPage.test.js | 13 +++++++++++++ app/src/tests/pages/StoryEditPage.test.js | 13 +++++++++++++ app/src/tests/pages/UtterPage.test.js | 13 +++++++++++++ 5 files changed, 65 insertions(+) create mode 100644 app/src/tests/pages/App.test.js create mode 100644 app/src/tests/pages/IntentPage.test.js create mode 100644 app/src/tests/pages/StoriesPage.test.js create mode 100644 app/src/tests/pages/StoryEditPage.test.js create mode 100644 app/src/tests/pages/UtterPage.test.js diff --git a/app/src/tests/pages/App.test.js b/app/src/tests/pages/App.test.js new file mode 100644 index 0000000..40a097e --- /dev/null +++ b/app/src/tests/pages/App.test.js @@ -0,0 +1,13 @@ +import App from '../../pages/App'; +import Adapter from 'enzyme-adapter-react-16'; +import Enzyme from 'enzyme'; + +Enzyme.configure({ adapter: new Adapter() }); + +describe('Testing App Page', () => { + + it('should render as expected', function() { + const tree = App(); + expect(tree).toMatchSnapshot(); + }); + }); \ No newline at end of file diff --git a/app/src/tests/pages/IntentPage.test.js b/app/src/tests/pages/IntentPage.test.js new file mode 100644 index 0000000..64dcec0 --- /dev/null +++ b/app/src/tests/pages/IntentPage.test.js @@ -0,0 +1,13 @@ +import IntentPage from '../../pages/IntentPage'; +import Adapter from 'enzyme-adapter-react-16'; +import Enzyme from 'enzyme'; + +Enzyme.configure({ adapter: new Adapter() }); + +describe('Testing Intent Page', () => { + + it('should render as expected', function() { + const tree = IntentPage; + expect(tree).toMatchSnapshot(); + }); + }); \ No newline at end of file diff --git a/app/src/tests/pages/StoriesPage.test.js b/app/src/tests/pages/StoriesPage.test.js new file mode 100644 index 0000000..7a25aaa --- /dev/null +++ b/app/src/tests/pages/StoriesPage.test.js @@ -0,0 +1,13 @@ +import StoriesPage from '../../pages/StoriesPage'; +import Adapter from 'enzyme-adapter-react-16'; +import Enzyme from 'enzyme'; + +Enzyme.configure({ adapter: new Adapter() }); + +describe('Testing Stories Page', () => { + + it('should render as expected', function() { + const tree = StoriesPage; + expect(tree).toMatchSnapshot(); + }); + }); \ No newline at end of file diff --git a/app/src/tests/pages/StoryEditPage.test.js b/app/src/tests/pages/StoryEditPage.test.js new file mode 100644 index 0000000..15d1fd5 --- /dev/null +++ b/app/src/tests/pages/StoryEditPage.test.js @@ -0,0 +1,13 @@ +import StoryEditPage from '../../pages/StoryEditPage'; +import Adapter from 'enzyme-adapter-react-16'; +import Enzyme from 'enzyme'; + +Enzyme.configure({ adapter: new Adapter() }); + +describe('Testing Story Edit Page', () => { + + it('should render as expected', function() { + const tree = StoryEditPage; + expect(tree).toMatchSnapshot(); + }); + }); \ No newline at end of file diff --git a/app/src/tests/pages/UtterPage.test.js b/app/src/tests/pages/UtterPage.test.js new file mode 100644 index 0000000..96d2dfb --- /dev/null +++ b/app/src/tests/pages/UtterPage.test.js @@ -0,0 +1,13 @@ +import UtterPage from '../../pages/UtterPage'; +import Adapter from 'enzyme-adapter-react-16'; +import Enzyme from 'enzyme'; + +Enzyme.configure({ adapter: new Adapter() }); + +describe('Testing Utter Page', () => { + + it('should render as expected', function() { + const tree = UtterPage; + expect(tree).toMatchSnapshot(); + }); + }); \ No newline at end of file From fe4a866536f04ee086759d8f44358f073aecd321 Mon Sep 17 00:00:00 2001 From: Amanda Muniz Date: Thu, 8 Apr 2021 14:33:41 -0300 Subject: [PATCH 5/5] [#155] - Adding test to index ducks Co-authored-by: Amanda Muniz Co-authored-by: Leticia Araujo --- app/src/tests/ducks/index.test.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 app/src/tests/ducks/index.test.js diff --git a/app/src/tests/ducks/index.test.js b/app/src/tests/ducks/index.test.js new file mode 100644 index 0000000..af25d94 --- /dev/null +++ b/app/src/tests/ducks/index.test.js @@ -0,0 +1,13 @@ +import configureStore from '../../ducks/index'; +import Adapter from 'enzyme-adapter-react-16'; +import Enzyme from 'enzyme'; + +Enzyme.configure({ adapter: new Adapter() }); + +describe('Testing Ducks Index', () => { + + it('should render as expected', function() { + const tree = configureStore(); + expect(tree).toMatchSnapshot(); + }); + }); \ No newline at end of file