11const mongoose = require ( 'mongoose' ) ;
2- // https://www.npmjs.com/package/chai
32const chai = require ( 'chai' ) ;
4- // http://www.chaijs.com/plugins/chai-http/
53const chaiHttp = require ( 'chai-http' ) ;
64const jsonwebtoken = require ( 'jsonwebtoken' ) ;
75const faker = require ( 'faker' ) ;
@@ -85,7 +83,7 @@ describe('Integration tests for: /api/home', function() {
8583 afterEach ( function ( ) {
8684
8785 return new Promise ( ( resolve , reject ) => {
88-
86+
8987 // Deletes the entire database.
9088 mongoose . connection . dropDatabase ( )
9189 . then ( result => {
@@ -109,27 +107,27 @@ describe('Integration tests for: /api/home', function() {
109107 . get ( '/api/home' )
110108 . set ( 'Authorization' , `Bearer ${ jwtToken } ` )
111109 . then ( res => {
112- console . log ( "The body:" , res . body [ 0 ] . sets ) ;
110+ console . log ( "The body:" , res . body [ 0 ] . sets ) ;
113111 expect ( res ) . to . have . status ( HTTP_STATUS_CODES . OK ) ;
114112 expect ( res ) . to . be . json ;
115113 expect ( res . body ) . to . be . a ( 'array' ) ;
116114 expect ( res . body ) . to . have . lengthOf . at . least ( 1 ) ;
117-
115+
118116 const workout = res . body [ 0 ] ;
119117 console . log ( "User workout:" , workout )
120-
121- expect ( workout ) . to . include . keys ( 'user' , 'sets' ) ;
122- expect ( workout . sets ) . to . include . keys ( 'exercise' , 'set' , 'reps' )
118+
119+ expect ( workout ) . to . include . keys ( 'user' , 'sets' ) ;
120+ expect ( workout . sets ) . to . include . keys ( 'exercise' , 'set' , 'reps' )
123121 expect ( workout . user ) . to . be . a ( 'string' ) ;
124-
122+
125123 } ) ;
126124 } ) ;
127125
128126 it ( 'Should return a specific workout' , function ( ) {
129127 let foundWorkout ;
130128 return Workout . find ( )
131129 . then ( workouts => {
132-
130+
133131 expect ( workouts ) . to . be . a ( 'array' ) ;
134132 expect ( workouts ) . to . have . lengthOf . at . least ( 1 ) ;
135133 foundWorkout = workouts [ 0 ] ;
@@ -139,11 +137,11 @@ describe('Integration tests for: /api/home', function() {
139137 . set ( 'Authorization' , `Bearer ${ jwtToken } ` ) ;
140138 } )
141139 . then ( res => {
142-
140+
143141 expect ( res ) . to . have . status ( HTTP_STATUS_CODES . OK ) ;
144142 expect ( res ) . to . be . json ;
145143 // expect(res.body).to.be.a('object');
146- expect ( res . body ) . to . include . keys ( 'user' , 'sets' ) ;
144+ expect ( res . body ) . to . include . keys ( 'user' , 'sets' ) ;
147145 expect ( res . body . sets ) . to . include . keys ( 'exercise' , 'set' , 'reps' ) ;
148146
149147 } ) ;
@@ -183,6 +181,6 @@ describe('Integration tests for: /api/home', function() {
183181 }
184182
185183 function createFakerWorkout ( ) {
186- return { sets :{ exercise : faker . lorem . word ( ) , set : faker . random . number ( ) , reps : faker . random . number ( ) } } ;
184+ return { sets : { exercise : faker . lorem . word ( ) , set : faker . random . number ( ) , reps : faker . random . number ( ) } } ;
187185 }
188- } ) ;
186+ } ) ;
0 commit comments