diff --git a/e2e/__snapshots__/individually.test.ts.snap b/e2e/__snapshots__/individually.test.ts.snap index 9681e60c..6bcb28d8 100644 --- a/e2e/__snapshots__/individually.test.ts.snap +++ b/e2e/__snapshots__/individually.test.ts.snap @@ -269,16 +269,6 @@ exports[`individually 6`] = ` }, "Type": "AWS::Lambda::Permission", }, - "Hello1LambdaVersionCSwh1ndXXWK0PuziFcAZEvHblwz5E8ZASq6DpWhA": { - "DeletionPolicy": "Retain", - "Properties": { - "CodeSha256": Any, - "FunctionName": { - "Ref": "Hello1LambdaFunction", - }, - }, - "Type": "AWS::Lambda::Version", - }, "Hello1LogGroup": { "Properties": { "LogGroupName": "/aws/lambda/serverless-example-dev-hello1", @@ -347,16 +337,6 @@ exports[`individually 6`] = ` }, "Type": "AWS::Lambda::Permission", }, - "Hello2LambdaVersionwMMe1vFJ1KSlA5MihlkJVM5uJp72R4R6u5Vtbnz3NSY": { - "DeletionPolicy": "Retain", - "Properties": { - "CodeSha256": Any, - "FunctionName": { - "Ref": "Hello2LambdaFunction", - }, - }, - "Type": "AWS::Lambda::Version", - }, "Hello2LogGroup": { "Properties": { "LogGroupName": "/aws/lambda/serverless-example-dev-hello2", @@ -528,3 +508,29 @@ exports[`individually 7`] = ` "Type": "AWS::ApiGateway::Deployment", } `; + +exports[`individually 8`] = ` +{ + "DeletionPolicy": "Retain", + "Properties": { + "CodeSha256": Any, + "FunctionName": { + "Ref": "Hello1LambdaFunction", + }, + }, + "Type": "AWS::Lambda::Version", +} +`; + +exports[`individually 9`] = ` +{ + "DeletionPolicy": "Retain", + "Properties": { + "CodeSha256": Any, + "FunctionName": { + "Ref": "Hello2LambdaFunction", + }, + }, + "Type": "AWS::Lambda::Version", +} +`; diff --git a/e2e/__snapshots__/minimal.test.ts.snap b/e2e/__snapshots__/minimal.test.ts.snap index cb814a22..d4f8e5f2 100644 --- a/e2e/__snapshots__/minimal.test.ts.snap +++ b/e2e/__snapshots__/minimal.test.ts.snap @@ -14269,16 +14269,6 @@ exports[`minimal 5`] = ` }, "Type": "AWS::Lambda::Permission", }, - "ValidateIsinLambdaVersionEpft2h1OOZyD03CU8JMaqcj3Xcth3KeWrSuKw8G2UQ": { - "DeletionPolicy": "Retain", - "Properties": { - "CodeSha256": Any, - "FunctionName": { - "Ref": "ValidateIsinLambdaFunction", - }, - }, - "Type": "AWS::Lambda::Version", - }, "ValidateIsinLogGroup": { "Properties": { "LogGroupName": "/aws/lambda/minimal-example-dev-validateIsin", @@ -14302,3 +14292,16 @@ exports[`minimal 6`] = ` "Type": "AWS::ApiGateway::Deployment", } `; + +exports[`minimal 7`] = ` +{ + "DeletionPolicy": "Retain", + "Properties": { + "CodeSha256": Any, + "FunctionName": { + "Ref": "ValidateIsinLambdaFunction", + }, + }, + "Type": "AWS::Lambda::Version", +} +`; diff --git a/e2e/individually.test.ts b/e2e/individually.test.ts index d434af66..46e6479e 100644 --- a/e2e/individually.test.ts +++ b/e2e/individually.test.ts @@ -34,8 +34,18 @@ test('individually', () => { s.startsWith('ApiGatewayDeployment') ) as keyof typeof cloudformation.Resources; - const { [apiGatewayDeploymentPropertyKey]: apiGatewayDeployment, ...deterministicResources } = - cloudformation.Resources; + const hello1LambdaVersionPropertyKey = cloudformation.Outputs.Hello1LambdaFunctionQualifiedArn.Value + .Ref as keyof typeof cloudformation.Resources; + + const hello2LambdaVersionPropertyKey = cloudformation.Outputs.Hello2LambdaFunctionQualifiedArn.Value + .Ref as keyof typeof cloudformation.Resources; + + const { + [apiGatewayDeploymentPropertyKey]: apiGatewayDeployment, + [hello1LambdaVersionPropertyKey]: hello1LambdaVersion, + [hello2LambdaVersionPropertyKey]: hello2LambdaVersion, + ...deterministicResources + } = cloudformation.Resources; expect(deterministicResources).toMatchSnapshot({ Hello1LambdaFunction: { @@ -48,13 +58,13 @@ test('individually', () => { Code: { S3Key: expect.stringContaining('hello2.zip') }, }, }, - [Object.keys(deterministicResources).find((s) => s.startsWith('Hello1LambdaVersion')) as string]: { - Properties: { CodeSha256: expect.any(String) }, - }, - [Object.keys(deterministicResources).find((s) => s.startsWith('Hello2LambdaVersion')) as string]: { - Properties: { CodeSha256: expect.any(String) }, - }, }); expect(apiGatewayDeployment).toMatchSnapshot(); + expect(hello1LambdaVersion).toMatchSnapshot({ + Properties: { CodeSha256: expect.any(String) }, + }); + expect(hello2LambdaVersion).toMatchSnapshot({ + Properties: { CodeSha256: expect.any(String) }, + }); }); diff --git a/e2e/minimal.test.ts b/e2e/minimal.test.ts index 29c5e1b1..38352131 100644 --- a/e2e/minimal.test.ts +++ b/e2e/minimal.test.ts @@ -26,8 +26,14 @@ test('minimal', () => { s.startsWith('ApiGatewayDeployment') ) as keyof typeof cloudformation.Resources; - const { [apiGatewayDeploymentPropertyKey]: apiGatewayDeployment, ...deterministicResources } = - cloudformation.Resources; + const validateIsinLambdaVersionPropertyKey = cloudformation.Outputs.ValidateIsinLambdaFunctionQualifiedArn.Value + .Ref as keyof typeof cloudformation.Resources; + + const { + [apiGatewayDeploymentPropertyKey]: apiGatewayDeployment, + [validateIsinLambdaVersionPropertyKey]: validateIsinLambdaVersion, + ...deterministicResources + } = cloudformation.Resources; expect(deterministicResources).toMatchSnapshot({ ValidateIsinLambdaFunction: { @@ -35,10 +41,10 @@ test('minimal', () => { Code: { S3Key: expect.stringContaining('minimal-example.zip') }, }, }, - [Object.keys(deterministicResources).find((s) => s.startsWith('ValidateIsinLambdaVersion')) as string]: { - Properties: { CodeSha256: expect.any(String) }, - }, }); expect(apiGatewayDeployment).toMatchSnapshot(); + expect(validateIsinLambdaVersion).toMatchSnapshot({ + Properties: { CodeSha256: expect.any(String) }, + }); });