@@ -328,52 +328,6 @@ describe('Error Handling Tests:', function () {
328328 expect ( error . name ) . toEqual ( 'ConfigurationError' )
329329 } ) // end it
330330
331- it ( 'ResponseError with string message' , async function ( ) {
332- let _event = Object . assign ( { } , event , { path : '/testError' } ) ;
333- let result = await new Promise ( r => api5 . run ( _event , { } , ( e , res ) => { r ( res ) } ) ) ;
334- expect ( result ) . toEqual ( {
335- multiValueHeaders : { 'content-type' : [ 'application/json' ] } ,
336- statusCode : 500 ,
337- body : '{"error":"This is a test error message"}' ,
338- isBase64Encoded : false
339- } ) ;
340- } ) ;
341-
342- it ( 'ResponseError with code and message' , async function ( ) {
343- let _event = Object . assign ( { } , event , { path : '/testError' } ) ;
344- let result = await new Promise ( r => api4 . run ( _event , { } , ( e , res ) => { r ( res ) } ) ) ;
345- expect ( result ) . toEqual ( {
346- multiValueHeaders : { } ,
347- statusCode : 500 ,
348- body : 'this is an error: false' ,
349- isBase64Encoded : false
350- } ) ;
351- } ) ;
352-
353- it ( 'ResponseError with message and detail' , async function ( ) {
354- let _event = Object . assign ( { } , event , { path : '/testErrorDetail' } ) ;
355- let result = await new Promise ( r => api5 . run ( _event , { } , ( e , res ) => { r ( res ) } ) ) ;
356- expect ( result ) . toEqual ( {
357- multiValueHeaders : { 'content-type' : [ 'application/json' ] } ,
358- statusCode : 500 ,
359- body : '{"error":"This is a test error message"}' ,
360- isBase64Encoded : false
361- } ) ;
362- } ) ;
363-
364- it ( 'ResponseError properties' , function ( ) {
365- const error = new errors . ResponseError ( 'test message' , 403 , { foo : 'bar' } ) ;
366- expect ( error . name ) . toBe ( 'ResponseError' ) ;
367- expect ( error . message ) . toBe ( 'test message' ) ;
368- expect ( error . code ) . toBe ( 403 ) ;
369- expect ( error . detail ) . toEqual ( { foo : 'bar' } ) ;
370- } ) ;
371-
372- it ( 'ResponseError default code' , function ( ) {
373- const error = new errors . ResponseError ( 'test message' ) ;
374- expect ( error . code ) . toBe ( 500 ) ;
375- } ) ;
376-
377331 it ( 'ApiError with string message' , async function ( ) {
378332 let _event = Object . assign ( { } , event , { path : '/testError' } ) ;
379333 let result = await new Promise ( r => api5 . run ( _event , { } , ( e , res ) => { r ( res ) } ) ) ;
0 commit comments