@@ -107,11 +107,25 @@ describe('Integration tests for: /api/home', function() {
107107 . get ( '/api/home' )
108108 . set ( 'Authorization' , `Bearer ${ jwtToken } ` )
109109 . then ( res => {
110+ < << << << HEAD
111+ console . log ( "The body:" , res . body [ 0 ] . sets ) ;
112+ = === ===
110113 console . log ( "The body:" , res . body [ 0 ] . sets ) ;
114+ > >>> >>> dff35dff0e6fd194376bd54c2775744a4a60aa8b
111115 expect ( res ) . to . have . status ( HTTP_STATUS_CODES . OK ) ;
112116 expect ( res ) . to . be . json ;
113117 expect ( res . body ) . to . be . a ( 'array' ) ;
114118 expect ( res . body ) . to . have . lengthOf . at . least ( 1 ) ;
119+ < << << << HEAD
120+
121+ const workout = res . body [ 0 ] ;
122+ console . log ( "User workout:" , workout )
123+
124+ expect ( workout ) . to . include . keys ( 'user' , 'sets' ) ;
125+ expect ( workout . sets ) . to . include . keys ( 'exercise' , 'set' , 'reps' )
126+ expect ( workout . user ) . to . be . a ( 'string' ) ;
127+
128+ = === ===
115129
116130 const workout = res . body [ 0 ] ;
117131 console . log ( "User workout:" , workout )
@@ -120,14 +134,19 @@ describe('Integration tests for: /api/home', function() {
120134 expect ( workout . sets ) . to . include . keys ( 'exercise' , 'set' , 'reps' )
121135 expect ( workout . user ) . to . be . a ( 'string' ) ;
122136
137+ > >>> >>> dff35dff0e6fd194376bd54c2775744a4a60aa8b
123138 } ) ;
124139 } ) ;
125140
126141 it ( 'Should return a specific workout' , function ( ) {
127142 let foundWorkout ;
128143 return Workout . find ( )
129144 . then ( workouts => {
145+ < << << << HEAD
146+
147+ === = ===
130148
149+ >>> > >>> dff35dff0e6fd194376bd54c2775744a4a60aa8b
131150 expect ( workouts ) . to . be . a ( 'array' ) ;
132151 expect ( workouts ) . to . have . lengthOf . at . least ( 1 ) ;
133152 foundWorkout = workouts [ 0 ] ;
@@ -137,11 +156,19 @@ describe('Integration tests for: /api/home', function() {
137156 . set ( 'Authorization' , `Bearer ${ jwtToken } ` ) ;
138157 } )
139158 . then ( res => {
159+ < << << << HEAD
160+
161+ expect ( res ) . to . have . status ( HTTP_STATUS_CODES . OK ) ;
162+ expect ( res ) . to . be . json ;
163+ // expect(res.body).to.be.a('object');
164+ expect ( res . body ) . to . include . keys ( 'user' , 'sets' ) ;
165+ = === ===
140166
141167 expect ( res ) . to . have . status ( HTTP_STATUS_CODES . OK ) ;
142168 expect ( res ) . to . be . json ;
143169 // expect(res.body).to.be.a('object');
144170 expect ( res . body ) . to . include . keys ( 'user' , 'sets' ) ;
171+ > >>> >>> dff35dff0e6fd194376bd54c2775744a4a60aa8b
145172 expect ( res . body . sets ) . to . include . keys ( 'exercise' , 'set' , 'reps' ) ;
146173
147174 } ) ;
@@ -181,6 +208,10 @@ describe('Integration tests for: /api/home', function() {
181208 }
182209
183210 function createFakerWorkout ( ) {
211+ < << << << HEAD
212+ return { sets :{ exercise : faker . lorem . word ( ) , set : faker . random . number ( ) , reps : faker . random . number ( ) } } ;
213+ === === =
184214 return { sets : { exercise : faker . lorem . word ( ) , set : faker . random . number ( ) , reps : faker . random . number ( ) } } ;
215+ >>> >>> > dff35dff0e6fd194376bd54c2775744a4a60aa8b
185216 }
186217} ) ;
0 commit comments