1- import _ from 'underscore' ;
21import { Application , Request , Response } from '../../src' ;
3- import { apiGatewayRequest , handlerContext } from '../samples' ;
2+ import { handlerContext , makeAPIGatewayRequestEvent } from '../samples' ;
43import { expect } from 'chai' ;
54import { RouteMatchingProcessorChain } from '../../src/chains/RouteMatchingProcessorChain' ;
65import { PathParams } from '../../src/interfaces' ;
@@ -22,7 +21,7 @@ describe('RouteMatchingProcessorChain', () => {
2221 describe ( 'matches' , ( ) => {
2322 const test = ( method : string | undefined , routes : PathParams , path : string , expectation : boolean , caseSensitive = false ) : void => {
2423 let app = new Application ( ) ,
25- req = new Request ( app , _ . extend ( apiGatewayRequest ( ) , { path : path } ) , handlerContext ( ) ) ,
24+ req = new Request ( app , makeAPIGatewayRequestEvent ( { path : path } ) , handlerContext ( ) ) ,
2625 chain = new RouteMatchingProcessorChain ( [ ] , routes , method , caseSensitive ) ;
2726
2827 expect ( chain . matches ( req ) ) . to . eql ( expectation ) ;
@@ -138,7 +137,7 @@ describe('RouteMatchingProcessorChain', () => {
138137 describe ( 'makeSubRequest' , ( ) => {
139138 const test = ( routes : PathParams , path : string , expectation : StringMap ) : void => {
140139 let app = new Application ( ) ,
141- req = new Request ( app , _ . extend ( apiGatewayRequest ( ) , { path : path } ) , handlerContext ( ) ) ,
140+ req = new Request ( app , makeAPIGatewayRequestEvent ( { path : path } ) , handlerContext ( ) ) ,
142141 chain = new TestRouteMatchingProcessorChain ( [ ] , routes ) ,
143142 subReq = chain . _makeSubRequest ( req ) ;
144143
@@ -154,7 +153,7 @@ describe('RouteMatchingProcessorChain', () => {
154153 // sending this character using UTF-8 encoding (i.e. %C3%AA)
155154 const path = '/hello/%EA' ,
156155 app = new Application ( ) ,
157- req = new Request ( app , _ . extend ( apiGatewayRequest ( ) , { path } ) , handlerContext ( ) ) ,
156+ req = new Request ( app , makeAPIGatewayRequestEvent ( { path } ) , handlerContext ( ) ) ,
158157 chain = new RouteMatchingProcessorChain ( [ ] , '/hello/:name' ) ,
159158 resp = new Response ( app , req , spy ( ) ) ,
160159 done = spy ( ) ;
0 commit comments