@@ -581,7 +581,6 @@ describe('#validateServiceProxies()', () => {
581
581
582
582
const proxiesToTest = [
583
583
{ proxy : 'kinesis' , props : { streamName : 'streamName' } } ,
584
- { proxy : 's3' , props : { bucket : 'bucket' , action : 'PutObject' , key : 'myKey' } } ,
585
584
{ proxy : 'sns' , props : { topicName : 'topicName' } }
586
585
]
587
586
proxiesToTest . forEach ( ( { proxy, props } ) => {
@@ -896,11 +895,11 @@ describe('#validateServiceProxies()', () => {
896
895
)
897
896
}
898
897
899
- const shouldSucceed = ( key , value ) => {
898
+ const shouldSucceed = ( key , value , ... missing ) => {
900
899
serverlessApigatewayServiceProxy . serverless . service . custom = {
901
900
apiGatewayServiceProxies : [
902
901
{
903
- s3 : getProxy ( key , value )
902
+ s3 : getProxy ( key , value , ... missing )
904
903
}
905
904
]
906
905
}
@@ -1015,6 +1014,46 @@ describe('#validateServiceProxies()', () => {
1015
1014
{ param : 'myKey' }
1016
1015
)
1017
1016
} )
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
+ } )
1018
1057
} )
1019
1058
1020
1059
describe ( 'sns' , ( ) => {
0 commit comments