@@ -581,7 +581,6 @@ describe('#validateServiceProxies()', () => {
581581
582582 const proxiesToTest = [
583583 { proxy : 'kinesis' , props : { streamName : 'streamName' } } ,
584- { proxy : 's3' , props : { bucket : 'bucket' , action : 'PutObject' , key : 'myKey' } } ,
585584 { proxy : 'sns' , props : { topicName : 'topicName' } }
586585 ]
587586 proxiesToTest . forEach ( ( { proxy, props } ) => {
@@ -896,11 +895,11 @@ describe('#validateServiceProxies()', () => {
896895 )
897896 }
898897
899- const shouldSucceed = ( key , value ) => {
898+ const shouldSucceed = ( key , value , ... missing ) => {
900899 serverlessApigatewayServiceProxy . serverless . service . custom = {
901900 apiGatewayServiceProxies : [
902901 {
903- s3 : getProxy ( key , value )
902+ s3 : getProxy ( key , value , ... missing )
904903 }
905904 ]
906905 }
@@ -1015,6 +1014,46 @@ describe('#validateServiceProxies()', () => {
10151014 { param : 'myKey' }
10161015 )
10171016 } )
1017+
1018+ it ( 'should throw if requestParameters is not a string to string mapping' , ( ) => {
1019+ shouldError (
1020+ 'child "s3" fails because [child "requestParameters" fails because [child "key2" fails because ["key2" must be a string]]]' ,
1021+ 'requestParameters' ,
1022+ { key1 : 'value' , key2 : [ ] }
1023+ )
1024+ } )
1025+
1026+ it ( 'should not throw if requestParameters is a string to string mapping' , ( ) => {
1027+ shouldSucceed ( 'requestParameters' , { key1 : 'value1' , key2 : 'value2' } )
1028+ } )
1029+
1030+ it ( 'should throw if requestParameters has "integration.request.path.object" and key is defined' , ( ) => {
1031+ shouldError (
1032+ 'child "s3" fails because [child "key" fails because ["key" is not allowed]]' ,
1033+ 'requestParameters' ,
1034+ {
1035+ 'integration.request.path.object' : 'context.requestId' ,
1036+ 'integration.request.header.cache-control' : "'public, max-age=31536000, immutable'"
1037+ }
1038+ )
1039+ } )
1040+
1041+ it ( 'should not throw if requestParameters has "integration.request.path.object" and key is not defined' , ( ) => {
1042+ shouldSucceed (
1043+ 'requestParameters' ,
1044+ {
1045+ 'integration.request.path.object' : 'context.requestId' ,
1046+ 'integration.request.header.cache-control' : "'public, max-age=31536000, immutable'"
1047+ } ,
1048+ 'key'
1049+ )
1050+ } )
1051+
1052+ it ( `should not throw if requestParameters doesn't have "integration.request.path.object" and key is defined` , ( ) => {
1053+ shouldSucceed ( 'requestParameters' , {
1054+ 'integration.request.header.cache-control' : "'public, max-age=31536000, immutable'"
1055+ } )
1056+ } )
10181057 } )
10191058
10201059 describe ( 'sns' , ( ) => {
0 commit comments