@@ -60,13 +60,13 @@ describe('loopback json api errors', function () {
6060 } )
6161
6262 describe ( 'status codes' , function ( ) {
63- it ( 'GET /models/100 should return a generalized 400 not found error' , function ( done ) {
63+ it ( 'GET /models/100 should return a 404 not found error' , function ( done ) {
6464 request ( app ) . get ( '/posts/100' )
65- . expect ( 400 )
65+ . expect ( 404 )
6666 . end ( done )
6767 } )
6868
69- it ( 'GET /models/100 should return a generalized 400 not found error' , function ( done ) {
69+ it ( 'GET /models/100 should return a 404 not found error' , function ( done ) {
7070 request ( app ) . get ( '/posts/100' )
7171 . end ( function ( err , res ) {
7272 expect ( err ) . to . equal ( null )
@@ -83,17 +83,17 @@ describe('loopback json api errors', function () {
8383 } )
8484 } )
8585
86- it ( 'POST /models should return a general 400 status code if type key is not present' , function ( done ) {
86+ it ( 'POST /models should return a 422 status code if type key is not present' , function ( done ) {
8787 request ( app ) . post ( '/posts' )
88- . send ( { data : { attributes : { title : 'my post' , content : 'my post content' } } } )
89- . expect ( 400 )
88+ . send ( { data : { attributes : { title : 'my post' , content : 'my post content' } } } )
89+ . expect ( 422 )
9090 . set ( 'Content-Type' , 'application/json' )
9191 . end ( done )
9292 } )
9393
9494 it ( 'POST /models should return a more specific 422 status code on the error object if type key is not present' , function ( done ) {
9595 request ( app ) . post ( '/posts' )
96- . send ( { data : { attributes : { title : 'my post' , content : 'my post content' } } } )
96+ . send ( { data : { attributes : { title : 'my post' , content : 'my post content' } } } )
9797 . set ( 'Content-Type' , 'application/json' )
9898 . end ( function ( err , res ) {
9999 expect ( err ) . to . equal ( null )
@@ -110,12 +110,12 @@ describe('loopback json api errors', function () {
110110 } )
111111 } )
112112
113- it ( 'POST /models should return an 400 error if model title is not present' , function ( done ) {
113+ it ( 'POST /models should return an 422 error if model title is not present' , function ( done ) {
114114 Post . validatesPresenceOf ( 'title' )
115115
116116 request ( app ) . post ( '/posts' )
117117 . send ( { data : { type : 'posts' } } )
118- . expect ( 400 )
118+ . expect ( 422 )
119119 . set ( 'Content-Type' , 'application/json' )
120120 . end ( done )
121121 } )
0 commit comments