Skip to content

Commit

Permalink
Added tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tobuck-aws committed Mar 8, 2024
1 parent fbd0111 commit a661e3a
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion test/control-plane.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

import { assert } from 'console';
import * as cdk from 'aws-cdk-lib';
import { Annotations, Match, Template, Capture } from 'aws-cdk-lib/assertions';
import { AwsSolutionsChecks } from 'cdk-nag';
Expand Down Expand Up @@ -59,7 +60,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;
Expand Down Expand Up @@ -113,4 +114,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)';
assert(actual == expected);
});

it('should have a concatenated template description, when the containing stack has an existing desc', () => {
const stackWithDescription = new TestStack(app, 'stackWithDescription', {
systemAdminEmail: 'test@example.com',
description: 'ABC',
});
const actual = stackWithDescription.templateOptions.description;
const expected = 'ABC - SaaS Builder Toolkit - CoreApplicationPlane (uksb-1tupboc57)';
assert(expected === actual);
});
});

0 comments on commit a661e3a

Please sign in to comment.