File tree Expand file tree Collapse file tree 3 files changed +40
-3
lines changed
Expand file tree Collapse file tree 3 files changed +40
-3
lines changed Original file line number Diff line number Diff line change 66 "axios" : " ^0.18.0" ,
77 "node-sass" : " ^4.11.0" ,
88 "prop-types" : " ^15.6.2" ,
9- "react" : " ^16.7.0 " ,
9+ "react" : " ^16.8.6 " ,
1010 "react-dom" : " ^16.7.0" ,
11- "react-redux" : " ^6.0 .0" ,
11+ "react-redux" : " ^7.0.0-beta .0" ,
1212 "react-scripts" : " 2.1.3" ,
1313 "redux" : " ^4.0.1" ,
1414 "redux-thunk" : " ^2.3.0"
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ class App extends Component {
3838 }
3939
4040 return (
41- < div className = "App" >
41+ < div className = "App" data-test = "appComponent" >
4242 < Header />
4343 < section className = "main" >
4444 < Headline header = "Posts" desc = "Click the button to render posts!" tempArr = { tempArr } />
Original file line number Diff line number Diff line change 1+ import App from './App' ;
2+ import { shallow } from 'enzyme' ;
3+ import { findByTestAtrr , testStore } from './../Utils' ;
4+ import React from 'react' ;
5+
6+ const setUp = ( initialState = { } ) => {
7+ const store = testStore ( initialState ) ;
8+ const wrapper = shallow ( < App store = { store } /> ) . childAt ( 0 ) . dive ( ) ;
9+ return wrapper ;
10+ } ;
11+
12+ describe ( 'App Component' , ( ) => {
13+
14+ let wrapper ;
15+ beforeEach ( ( ) => {
16+ const initialState = {
17+ posts : [ {
18+ title : 'Example title 1' ,
19+ body : 'Some text'
20+ } , {
21+ title : 'Example title 2' ,
22+ body : 'Some text'
23+ } , {
24+ title : 'Example title 3' ,
25+ body : 'Some text'
26+ } ]
27+ }
28+ wrapper = setUp ( initialState ) ;
29+ } ) ;
30+
31+ it ( 'Should render without errors' , ( ) => {
32+ const component = findByTestAtrr ( wrapper , 'appComponent' ) ;
33+ expect ( component . length ) . toBe ( 1 ) ;
34+ } ) ;
35+
36+
37+ } ) ;
You can’t perform that action at this time.
0 commit comments