@@ -551,19 +551,23 @@ describe('Server', () => {
551551  } ) 
552552
553553  describe ( 'PUT /:resource/:id' ,  ( )  =>  { 
554-     it ( 'should respond with json and replace resource' ,  ( done )  =>  { 
554+     it . only ( 'should respond with json and replace resource' ,  ( done )  =>  { 
555555      var  post  =  { id : 1 ,  booleanValue : true ,  integerValue : 1 } 
556556      request ( server ) 
557557        . put ( '/posts/1' ) 
558+         . set ( 'Accept' ,  'application/json' ) 
558559        // body property omitted to test that the resource is replaced 
559560        . send ( post ) 
560561        . expect ( 'Content-Type' ,  / j s o n / ) 
561562        . expect ( post ) 
562563        . expect ( 200 ) 
563564        . end ( ( err ,  res )  =>  { 
564565          if  ( err )  return  done ( err ) 
566+           // TODO find a "supertest" way to test this 
567+           // https://github.com/typicode/json-server/issues/396 
568+           assert . deepStrictEqual ( res . body ,  post ) 
565569          // assert it was created in database too 
566-           assert . deepEqual ( db . posts [ 0 ] ,  post ) 
570+           assert . deepStrictEqual ( db . posts [ 0 ] ,  post ) 
567571          done ( ) 
568572        } ) 
569573    } ) 
@@ -588,8 +592,9 @@ describe('Server', () => {
588592        . expect ( 200 ) 
589593        . end ( ( err ,  res )  =>  { 
590594          if  ( err )  return  done ( err ) 
595+           assert . deepStrictEqual ( res . body ,  post ) 
591596          // assert it was created in database too 
592-           assert . deepEqual ( db . posts [ 0 ] ,  { id : 1 ,  body : 'bar' } ) 
597+           assert . deepStrictEqual ( db . posts [ 0 ] ,  { id : 1 ,  body : 'bar' } ) 
593598          done ( ) 
594599        } ) 
595600    } ) 
0 commit comments