diff --git a/src/App.test.js b/src/App.test.js
index 0bf528b..576794c 100644
--- a/src/App.test.js
+++ b/src/App.test.js
@@ -1,15 +1,17 @@
import React from 'react';
import ReactDOM from 'react-dom';
-import { Route } from 'react-router-dom';
+import { Route,MemoryRouter } from 'react-router-dom';
+
import App from './App';
import Adapter from 'enzyme-adapter-react-16';
-import { shallow,configure } from 'enzyme';
+import { shallow,mount,configure } from 'enzyme';
import Home from "./components/views/Home.js";
import CreateBallot from "./components/views/CreateBallot.js";
import UnknownView from "./components/views/UnknownView";
-configure({ adapter: new Adapter() })
+configure({ adapter: new Adapter() });
+
it('renders without crashing', () => {
const div = document.createElement('div');
@@ -18,12 +20,12 @@ it('renders without crashing', () => {
});
-let pathMap = {};
+/*let pathMap = {};
describe('open good View component for each route', () => {
beforeAll(() => {
- const App = shallow();
- pathMap = App.find(Route).reduce((pathMap, route) => {
+ const app = shallow();
+ pathMap = app.find(Route).reduce((pathMap, route) => {
const routeProps = route.props();
pathMap[routeProps.path] = routeProps.component;
return pathMap;
@@ -39,8 +41,39 @@ describe('open good View component for each route', () => {
expect(pathMap['/create-ballot']).toBe(CreateBallot);
});
- /*it('should show UnknowView component for `/xvwverdtebdj`', () => {
- expect(pathMap['/xvwverdtebdj']).toBe(UnknownView);
+
+});*/
+
+describe('open good View component for each route', () => {
+
+
+ it('should show Home component for `/`', () => {
+ const wrapper = mount(
+
+
+ );
+ expect(wrapper.find(Home)).toHaveLength(1);
+ expect(wrapper.find(UnknownView)).toHaveLength(0);
+ });
+
+
+ it('should show CreateBallot component for `/create-ballot`', () => {
+ const wrapper = mount(
+
+
+ );
+ expect(wrapper.find(CreateBallot)).toHaveLength(1);
+ expect(wrapper.find(UnknownView)).toHaveLength(0);
+ });
+
+
+ /* it('should show UnknownView component for `/aaabbbcccddd`', () => {
+ const wrapper = mount(
+
+
+ );
+ console.log(wrapper.debug());
+ expect(wrapper.find(UnknownView)).toHaveLength(1);
});*/
});
\ No newline at end of file