Skip to content

Commit 182a411

Browse files
Merge branch 'test' of https://github.com/tdwolf6/Chronos into staging-master
2 parents bb09435 + cda68cd commit 182a411

8 files changed

Lines changed: 176 additions & 17 deletions

File tree

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,39 @@
1-
xdescribe('<DashboardContainer />', () => {
2-
it('should render <SidebarContainer />');
3-
it('should render <MainContainer />');
4-
it('should render all of the contexts');
1+
import React from 'react';
2+
import { configure, shallow, render } from 'enzyme';
3+
// import Adapter from 'enzyme-adapter-react-16';
4+
// import renderer from 'react-test-renderer';
5+
// import { expect } from 'chai';
6+
import DashboardContainer from '../../../app/containers/DashboardContainer';
7+
import MainContainer from '../../../app/containers/MainContainer'
8+
import SidebarContainer from '../../../app/containers/SidebarContainer'
9+
import ApplicationContextProvider from '../../../app/context/ApplicationContext'
10+
// configure({ adapter: new Adapter() });
11+
12+
describe('<DashboardContainer />', () => {
13+
it(' renders component MainContainer ', () => {
14+
const wrapper = shallow(<DashboardContainer />);
15+
16+
expect(wrapper.contains(<MainContainer />)).toBe(true);
17+
expect(wrapper.contains(<SidebarContainer />)).toBe(true);
18+
});
19+
20+
it(' renders component SidebarContainer', () => {
21+
const wrapper = shallow(<DashboardContainer />);
22+
23+
expect(wrapper.contains(<SidebarContainer />)).toBe(true);
24+
});
25+
// it(' renders component SidebarContainer', () => {
26+
// const wrapper = shallow(<DashboardContainer />);
27+
28+
// expect(wrapper.contains( <ApplicationContextProvider></ApplicationContextProvider>)).toBe(true);
29+
// });
30+
531
});
32+
33+
34+
35+
// describe('<DashboardContainer />', () => {
36+
// it('should render <SidebarContainer />');
37+
// it('should render <MainContainer />');
38+
// it('should render all of the contexts');
39+
// });
Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
import React from 'react';
2+
import { configure, shallow, render } from 'enzyme';
3+
4+
import GraphsContainer from '../../../app/containers/GraphsContainer'
5+
// import SpeedChart from '../../../app/charts/speed-chart'
6+
17
xdescribe('<GraphsContainer />', () => {
2-
it('should');
3-
});
8+
it('should render graphs')
9+
})
10+
11+
// xdescribe('<GraphsContainer />', () => {
12+
// it('should', () => {
13+
// const wrapper = shallow(<GraphsContainer />);
14+
// expect(wrapper.contains(<SpeedChart/>)).toBe(true)
15+
// });
16+
// });
Lines changed: 59 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,60 @@
1-
xdescribe('<MainContainer />', () => {
2-
it('should');
1+
import React from 'react';
2+
import { configure, shallow, render } from 'enzyme';
3+
import { Route, Switch } from 'react-router-dom';
4+
5+
6+
import MainContainer from '../../../app/containers/MainContainer'
7+
import Home from '../../../app/components/Home'
8+
import Copyright from '../../../app/components/Copyright'
9+
import Occupied from '../../../app/components/Occupied'
10+
import GraphsContainer from '../../../app/containers/GraphsContainer'
11+
import About from '../../../app/components/About'
12+
import Contact from '../../../app/components/Contact';
13+
import Settings from '../../../app/components/Settings';
14+
15+
describe('<MainContainer />', () => {
16+
it(' renders component Home', () => {
17+
const wrapper = shallow(<MainContainer />);
18+
19+
expect(wrapper.contains(<Route exact path="/" component={Home} />)).toBe(true);
20+
});
21+
it('renders component Copyright', () => {
22+
const wrapper = shallow (<MainContainer />);
23+
24+
expect(wrapper.contains(<Copyright />)).toBe(true);
25+
26+
})
27+
it('renders component Occupied', () => {
28+
const wrapper = shallow (<MainContainer />);
29+
30+
expect(wrapper.contains(<Route exact path="/applications" component={Occupied} />)).toBe(true);
31+
32+
})
33+
it('renders container GraphsContainer', () => {
34+
const wrapper = shallow (<MainContainer />);
35+
36+
expect(wrapper.contains(<Route exact path="/applications/:app/:service" component={GraphsContainer} />)).toBe(true);
37+
38+
})
39+
it('renders container About', () => {
40+
const wrapper = shallow (<MainContainer />);
41+
42+
expect(wrapper.contains(<Route path="/about" component={About} />)).toBe(true);
43+
44+
})
45+
it('renders container Contact', () => {
46+
const wrapper = shallow (<MainContainer />);
47+
48+
expect(wrapper.contains(<Route path="/contact" component={Contact} />)).toBe(true);
49+
50+
})
51+
it('renders container Settings', () => {
52+
const wrapper = shallow (<MainContainer />);
53+
54+
expect(wrapper.contains(<Route path="/settings" component={Settings} />)).toBe(true);
55+
56+
})
57+
358
});
59+
60+
Lines changed: 60 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,61 @@
1-
xdescribe('<SidebarContainer />', () => {
2-
it('should render an <img> tag with the Chronos logo');
3-
it("should render a <Link /> with the label as 'Home'");
4-
it("should render a <Link /> with the label as 'About'");
5-
it("should render a <Link /> with the label as 'Contact'");
6-
it("should render a <Link /> with the label as 'Settings'");
1+
import React from 'react';
2+
import { configure, shallow, render } from 'enzyme';
3+
4+
import HomeSharpIcon from '@material-ui/icons/HomeSharp';
5+
import InfoIcon from '@material-ui/icons/Info';
6+
import ContactSupportIcon from '@material-ui/icons/ContactSupport';
7+
import SettingsIcon from '@material-ui/icons/Settings';
8+
import SidebarContainer from '../../../app/containers/SidebarContainer'
9+
import { Link } from 'react-router-dom';
10+
11+
12+
describe('<SidebarContainer />', () => {
13+
it('should render an <img> tag with the Chronos logo', () => {
14+
const wrapper = shallow(<SidebarContainer />);
15+
console.log(wrapper.debug)
16+
expect(wrapper.contains(<img alt="Chronos Logo" id="serviceDashLogo" src="../assets/icon2Cropped.png" />)).toBe(true);
17+
});
18+
it("should render a <Link /> with the label as 'Home'", () => {
19+
const wrapper = shallow(<SidebarContainer />);
20+
21+
expect(wrapper.contains(<Link className="sidebar-link" to="/" id="home">
22+
<HomeSharpIcon style={{ boxShadow: 'none', width: '40px', height: '40px' }} />
23+
&emsp;Home
24+
</Link>)).toBe(true)
25+
});
26+
it("should render a <Link /> with the label as 'About'", () => {
27+
const wrapper = shallow(<SidebarContainer />);
28+
29+
expect(wrapper.contains(<Link className="sidebar-link" to="/about" id="about">
30+
<InfoIcon style={{ boxShadow: 'none', width: '40px', height: '40px' }} />
31+
&emsp;About
32+
</Link>)).toBe(true)
33+
});
34+
it("should render a <Link /> with the label as 'Contact'", () => {
35+
const wrapper = shallow(<SidebarContainer />);
36+
37+
expect(wrapper.contains(<Link className="sidebar-link" to="/contact" id="contact">
38+
<ContactSupportIcon style={{ boxShadow: 'none', width: '40px', height: '40px' }} />
39+
&emsp;Contact
40+
</Link>)).toBe(true)
41+
});
42+
it("should render a <Link /> with the label as 'Settings'", () => {
43+
const wrapper = shallow(<SidebarContainer />);
44+
45+
expect(wrapper.contains(<Link className="sidebar-link" to="/settings" id="settings">
46+
<SettingsIcon style={{ boxShadow: 'none', width: '40px', height: '40px' }} />
47+
&emsp;Settings
48+
</Link>)).toBe(true)
49+
});
50+
51+
752
});
53+
54+
55+
56+
57+
58+
59+
60+
61+

app/components/About.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'React';
1+
import React from 'react';
22

33
const About: React.FC = () => {
44
return <div className="home">Hello this is the About</div>;

app/components/Contact.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'React';
1+
import React from 'react';
22

33
const Contact: React.FC = () => {
44
return <div className="home">Hello this is the Contact</div>;

app/components/Settings.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'React';
1+
import React from 'react';
22

33
// Need to add flag to turn off the splash at start
44
// Need to add flag to turn off getting started page

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"@jest-runner/electron": "^2.0.3",
3636
"@material-ui/core": "^4.11.0",
3737
"@material-ui/icons": "^4.9.1",
38+
"@types/react-test-renderer": "^16.9.2",
3839
"chart.js": "^2.8.0",
3940
"d3": "^5.16.0",
4041
"electron": "^6.1.11",

0 commit comments

Comments
 (0)