@@ -9,14 +9,29 @@ describe('#compileRestApi()', () => {
9
9
let serverless ;
10
10
let serverlessStepFunctions ;
11
11
12
- const serviceResourcesAwsResourcesObjectMock = {
13
- Resources : {
14
- ApiGatewayRestApi : {
15
- Type : 'AWS::ApiGateway::RestApi' ,
16
- Properties : {
17
- Name : 'dev-new-service' ,
18
- EndpointConfiguration : {
19
- Types : [ 'EDGE' ] ,
12
+ const serviceresourcesawsresourcesprivateobjectmock = {
13
+ resources : {
14
+ apigatewayrestapi : {
15
+ type : 'aws::apigateway::restapi' ,
16
+ properties : {
17
+ name : 'dev-new-service' ,
18
+ endpointconfiguration : {
19
+ vpcEndpointIds : [ "vpc-0a60eb65b4foo" , "vpc-0a60eb65b4bar" ] ,
20
+ types : [ 'private' ] ,
21
+ } ,
22
+ } ,
23
+ } ,
24
+ } ,
25
+ } ;
26
+
27
+ const serviceresourcesawsresourcesobjectmock = {
28
+ resources : {
29
+ apigatewayrestapi : {
30
+ type : 'aws::apigateway::restapi' ,
31
+ properties : {
32
+ name : 'dev-new-service' ,
33
+ endpointconfiguration : {
34
+ types : [ 'edge' ] ,
20
35
} ,
21
36
} ,
22
37
} ,
@@ -135,8 +150,14 @@ describe('#compileRestApi()', () => {
135
150
expect ( ( ) => serverlessStepFunctions . compileRestApi ( ) ) . to . not . throw ( Error ) ;
136
151
} ) ;
137
152
138
- it ( 'should compile if endpointType property is PRIVATE' , ( ) => {
153
+ it ( 'should not compile if endpointType property is PRIVATE and no vpcEndpointIds' , ( ) => {
154
+ serverlessStepFunctions . serverless . service . provider . endpointType = 'PRIVATE' ;
155
+ expect ( ( ) => serverlessStepFunctions . compileRestApi ( ) ) . to . throw ( Error ) ;
156
+ } ) ;
157
+
158
+ it ( 'should compile if endpointType property is PRIVATE and vpcEndpointIds' , ( ) => {
139
159
serverlessStepFunctions . serverless . service . provider . endpointType = 'PRIVATE' ;
160
+ serverlessStepFunctions . serverless . service . provider . vpcEndpointIds = [ "vpc-0a60eb65b4foo" , "vpc-0a60eb65b4bar" ] ;
140
161
expect ( ( ) => serverlessStepFunctions . compileRestApi ( ) ) . to . not . throw ( Error ) ;
141
162
} ) ;
142
163
0 commit comments