-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add CloudFormation telemetry (#10)
* feat: Add CloudFormation telemtry * Added tests * assert => expect * expect => expect().toStrictEqual()
- Loading branch information
1 parent
3945b18
commit 32dfc67
Showing
5 changed files
with
35 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
export * from './event-manager'; | ||
export * from './utils'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import { Stack } from 'aws-cdk-lib'; | ||
import { Construct } from 'constructs'; | ||
|
||
export const setTemplateDesc = (construct: Construct, sbtDesc: string) => { | ||
const stackDesc = Stack.of(construct).templateOptions.description; | ||
let description = stackDesc === undefined ? sbtDesc : stackDesc + ' - ' + sbtDesc; | ||
Stack.of(construct).templateOptions.description = description; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,7 +59,7 @@ describe('No unsuppressed cdk-nag Warnings or Errors', () => { | |
}); | ||
}); | ||
|
||
describe('ControlPlane', () => { | ||
describe('ControlPlane without Description', () => { | ||
const app = new cdk.App(); | ||
interface TestStackProps extends cdk.StackProps { | ||
systemAdminEmail: string; | ||
|
@@ -113,4 +113,20 @@ describe('ControlPlane', () => { | |
expect(targetsCapture.asArray()).toHaveLength(1); | ||
} while (targetsCapture.next()); | ||
}); | ||
|
||
it('should have a fixed template description, when the containing stack does not have description', () => { | ||
const actual = controlPlaneTestStack.templateOptions.description; | ||
const expected = 'SaaS Builder Toolkit - CoreApplicationPlane (uksb-1tupboc57)'; | ||
expect(actual).toStrictEqual(expected); | ||
}); | ||
|
||
it('should have a concatenated template description, when the containing stack has an existing desc', () => { | ||
const stackWithDescription = new TestStack(app, 'stackWithDescription', { | ||
systemAdminEmail: '[email protected]', | ||
description: 'ABC', | ||
}); | ||
const actual = stackWithDescription.templateOptions.description; | ||
const expected = 'ABC - SaaS Builder Toolkit - CoreApplicationPlane (uksb-1tupboc57)'; | ||
expect(expected).toStrictEqual(actual); | ||
}); | ||
}); |