File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
lib/deploy/events/apiGateway Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -284,6 +284,20 @@ describe('#methods()', () => {
284284 } ) ;
285285 } ) ;
286286
287+ describe ( '#getLambdaProxyRequestTemplates()' , ( ) => {
288+ it ( 'application/json proxy template should not have escaped single quotes' , ( ) => {
289+ const lambdaProxyRequestTemplate = serverlessStepFunctions
290+ . getLambdaProxyRequestTemplates ( 'stateMachine' , undefined ) ;
291+
292+ // Using negative lookahead, look for escapeJavaScript calls without the
293+ // required stripping of escaped single quotes after
294+ const escapeJavascriptPattern = / \$ u t i l .e s c a p e J a v a S c r i p t \( " \$ \w + " \) / ;
295+ const unescapeSingleQuotesPattern = / \. r e p l a c e A l l \( " \\ \\ ' " , * " ' " \) / ;
296+ const regExp = new RegExp ( `${ escapeJavascriptPattern . source } (?!${ unescapeSingleQuotesPattern . source } )` ) ;
297+ expect ( lambdaProxyRequestTemplate [ 'application/json' ] [ 'Fn::Sub' ] [ 0 ] ) . not . to . match ( regExp ) ;
298+ } ) ;
299+ } ) ;
300+
287301 describe ( '#getMethodResponses()' , ( ) => {
288302 it ( 'should return a corresponding methodResponses resource' , ( ) => {
289303 expect ( serverlessStepFunctions . getMethodResponses ( ) . Properties )
You can’t perform that action at this time.
0 commit comments