diff --git a/packages/aws-cdk-lib/aws-lambda/lib/architecture.ts b/packages/aws-cdk-lib/aws-lambda/lib/architecture.ts index ae86624ca006b..8a8d709d4f14d 100644 --- a/packages/aws-cdk-lib/aws-lambda/lib/architecture.ts +++ b/packages/aws-cdk-lib/aws-lambda/lib/architecture.ts @@ -36,4 +36,11 @@ export class Architecture { this.name = archName; this.dockerPlatform = dockerPlatform; } + + /** + * Returns a string representation of the architecture using the name + */ + public toString(): string { + return this.name; + } } diff --git a/packages/aws-cdk-lib/aws-lambda/test/architecture.test.ts b/packages/aws-cdk-lib/aws-lambda/test/architecture.test.ts new file mode 100644 index 0000000000000..91e2823f09dae --- /dev/null +++ b/packages/aws-cdk-lib/aws-lambda/test/architecture.test.ts @@ -0,0 +1,21 @@ + +import { App, Stack } from '../../core'; +import * as lambda from '../lib'; + +describe('architecture', () => { + const app = new App(); + const stack = new Stack(app, 'stack'); + + test('toString to return the architecture name', () => { + // GIVEN + const testLambda = new lambda.Function(stack, 'testLambda', { + code: new lambda.InlineCode('foo'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + }, + ); + + // THEN + expect(`${testLambda.architecture}`).toEqual(testLambda.architecture.name); + }); +});