Skip to content

Commit

Permalink
test: add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
Arun Donti committed Sep 19, 2022
1 parent a32bcea commit f3ff870
Showing 1 changed file with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Template } from '@aws-cdk/assertions';
import { App, Stack } from '@aws-cdk/core';
import { LogType, InvocationType, ExpectedResult, ActualResult } from '../../lib/assertions';
import { ActualResult, ExpectedResult, InvocationType, LogType } from '../../lib/assertions';
import { DeployAssert } from '../../lib/assertions/private/deploy-assert';

describe('DeployAssert', () => {
Expand Down Expand Up @@ -145,5 +145,22 @@ describe('DeployAssert', () => {
template.resourceCountIs('Custom::DeployAssert@SdkCallMyServiceMyApi1', 1);
template.resourceCountIs('Custom::DeployAssert@SdkCallMyServiceMyApi2', 1);
});

test('custom resource type length is truncated when greater than 60 characters', () => {
// GIVEN
const app = new App();

// WHEN
const deplossert = new DeployAssert(app);
deplossert.awsApiCall('Pangram', 'TheQuickBrownFoxJumpsOverTheLazyDog');

// THEN
const truncatedType = 'Custom::DeployAssert@SdkCallPangramTheQuickBrownFoxJumpsOver';
expect(truncatedType.length).toEqual(60);

const template = Template.fromStack(deplossert.scope);
template.resourceCountIs('AWS::Lambda::Function', 1);
template.resourceCountIs(truncatedType, 1);
});
});
});

0 comments on commit f3ff870

Please sign in to comment.