22import { ProxyIntegrationConfig , process as proxyIntegration } from '../lib/proxyIntegration'
33
44import { APIGatewayProxyEvent } from 'aws-lambda'
5+ import { HttpMethod } from '../lib/EventProcessor'
56
67function forEach ( arrayOfArrays : any ) {
78 return {
@@ -266,7 +267,7 @@ describe('proxyIntegration.routeHandler', () => {
266267 [ 'GET' , '/abc/def' ] ,
267268 [ 'POST' , '/abc' ] ,
268269 [ 'PUT' , '/abc/def/ghi' ]
269- ] ) . it ( 'should call action for on method/staticPath' , async ( method : string , path : string ) => {
270+ ] ) . it ( 'should call action for on method/staticPath' , async ( method : HttpMethod , path : string ) => {
270271 const routeConfig : ProxyIntegrationConfig = {
271272 routes : [
272273 { method, path, action : ( ) => ( { foo : 'bar' } ) as any }
@@ -353,7 +354,7 @@ describe('proxyIntegration.routeHandler', () => {
353354 } )
354355
355356 it ( 'should return error headers' , async ( ) => {
356- const routeConfig = {
357+ const routeConfig : ProxyIntegrationConfig = {
357358 routes : [
358359 {
359360 method : 'GET' ,
@@ -374,7 +375,7 @@ describe('proxyIntegration.routeHandler', () => {
374375 } )
375376
376377 it ( 'should return error including CORS header' , async ( ) => {
377- const routeConfig = {
378+ const routeConfig : ProxyIntegrationConfig = {
378379 cors : true ,
379380 routes : [
380381 {
@@ -399,7 +400,7 @@ describe('proxyIntegration.routeHandler', () => {
399400 } )
400401 it ( 'should modify incorrect error' , async ( ) => {
401402 const incorrectError = { body : { reason : 'oops' } }
402- const routeConfig = {
403+ const routeConfig : ProxyIntegrationConfig = {
403404 routes : [
404405 {
405406 method : 'GET' ,
@@ -423,7 +424,7 @@ describe('proxyIntegration.routeHandler', () => {
423424
424425 it ( 'should pass through error statuscode' , async ( ) => {
425426 const statusCodeError = { statusCode : 666 , message : { reason : 'oops' } }
426- const routeConfig = {
427+ const routeConfig : ProxyIntegrationConfig = {
427428 routes : [
428429 {
429430 method : 'GET' ,
@@ -547,7 +548,7 @@ describe('proxyIntegration.routeHandler.returnvalues', () => {
547548 body : JSON . stringify ( { foo : 'bar' } )
548549 }
549550
550- const routeConfig = {
551+ const routeConfig : ProxyIntegrationConfig = {
551552 routes : [
552553 { method : 'GET' , path : '/' , action : ( ) => Promise . resolve ( customBody ) }
553554 ]
@@ -578,7 +579,7 @@ describe('proxyIntegration.routeHandler.returnvalues', () => {
578579 [ 1234 , '1234' ] ,
579580 [ undefined , '{}' ]
580581 ] ) . it ( 'should return async result' , async ( returnValue , expectedBody ) => {
581- const routeConfig = {
582+ const routeConfig : ProxyIntegrationConfig = {
582583 routes : [
583584 { method : 'GET' , path : '/' , action : ( ) => Promise . resolve ( returnValue ) }
584585 ]
@@ -595,9 +596,9 @@ describe('proxyIntegration.routeHandler.returnvalues', () => {
595596 } )
596597
597598 it ( 'should return async error' , async ( ) => {
598- const routeConfig = {
599+ const routeConfig : ProxyIntegrationConfig = {
599600 routes : [
600- { method : 'GET' , path : '/' , action : ( ) => Promise . reject ( { reason : 'myError' , message : 'doof' } ) }
601+ { method : 'GET' , path : '/' , action : ( ) => Promise . reject ( { reason : 'myError' , message : 'doof' } ) as any }
601602 ] ,
602603 errorMapping : { 'myError' : 599 }
603604 }
0 commit comments