Skip to content

Commit 93a4769

Browse files
author
Benoit Jean
committed
Add test to main
1 parent f52b1ed commit 93a4769

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

src/main/components/Main.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import React, {
88

99
import SchoolsList from './SchoolsList.jsx';
1010

11-
class AppComponent extends Component {
11+
class MainComponent extends Component {
1212
constructor(props, context) {
1313
super(props, context)
1414
}
@@ -21,9 +21,9 @@ class AppComponent extends Component {
2121
}
2222
}
2323

24-
AppComponent.defaultProps = {
24+
MainComponent.defaultProps = {
2525
schools: PropTypes.object.isRequired,
2626
actions: PropTypes.object.isRequired
2727
};
2828

29-
export default AppComponent;
29+
export default MainComponent;

src/test/components/MainTest.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,26 @@ import Main from 'components/Main';
1515
import SchoolsList from 'components/SchoolsList';
1616

1717

18-
describe('MainComponent', () => {
18+
describe('AppComponent', () => {
1919
let MainComponent;
2020

2121
beforeEach(() => {
22-
MainComponent = createComponent(Main);
22+
const props = Object.assign({
23+
schools: [],
24+
actions: {}
25+
})
26+
MainComponent = createComponent(Main,props);
2327
});
2428

2529
it('should render the SchoolsList', () => {
2630
expect(MainComponent.type).toBeA(Function)
2731
});
32+
33+
it('should render a list of schools', () => {
34+
expect(MainComponent.props.schools).toBeA(Array)
35+
});
36+
37+
it('should provide the list of actions', () => {
38+
expect(MainComponent.props.actions).toBeA(Object)
39+
});
2840
});

0 commit comments

Comments
 (0)