Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
comcalvi committed Feb 19, 2024
1 parent d391cb1 commit b4f04e5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions packages/@aws-cdk/cloudformation-diff/lib/diff-template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export function fullDiff(
normalize(newTemplate);
const theDiff = diffTemplate(currentTemplate, newTemplate);
if (changeSet) {
filterFalsePositivies(theDiff, changeSet);
filterFalsePositives(theDiff, changeSet);
addImportInformation(theDiff, changeSet);
}

Expand Down Expand Up @@ -218,7 +218,7 @@ function addImportInformation(diff: types.TemplateDiff, changeSet: CloudFormatio
});
}

function filterFalsePositivies(diff: types.TemplateDiff, changeSet: CloudFormation.DescribeChangeSetOutput) {
function filterFalsePositives(diff: types.TemplateDiff, changeSet: CloudFormation.DescribeChangeSetOutput) {
const replacements = findResourceReplacements(changeSet);
diff.resources.forEachDifference((logicalId: string, change: types.ResourceDifference) => {
change.forEachDifference((type: 'Property' | 'Other', name: string, value: types.Difference<any> | types.PropertyDifference<any>) => {
Expand Down
6 changes: 3 additions & 3 deletions packages/aws-cdk/lib/api/nested-stack-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import { CloudFormationStack, Template } from './util/cloudformation';

export interface NestedStackTemplates {
readonly physicalName: string | undefined;
readonly deployedTemplate: Template
readonly generatedTemplate: Template
readonly nestedStackTemplates: { [nestedStackLogicalId: string]: NestedStackTemplates}
readonly deployedTemplate: Template;
readonly generatedTemplate: Template;
readonly nestedStackTemplates: { [nestedStackLogicalId: string]: NestedStackTemplates};
}

export interface RootTemplateWithNestedStacks {
Expand Down
7 changes: 4 additions & 3 deletions packages/aws-cdk/test/diff.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ let toolkit: CdkToolkit;

describe('imports', () => {
beforeEach(() => {
jest.spyOn(cfn, 'createDiffChangeSet').mockImplementation(async () => {
jest.spyOn(cfn, 'createDiffChangeSet').mockImplementationOnce(async () => {
return {
Changes: [
{
Expand Down Expand Up @@ -70,8 +70,8 @@ describe('imports', () => {
// Default implementations
cloudFormation.readCurrentTemplateWithNestedStacks.mockImplementation((_stackArtifact: CloudFormationStackArtifact) => {
return Promise.resolve({
deployedTemplate: {},
nestedStackCount: 0,
deployedRootTemplate: {},
nestedStacks: {},
});
});
cloudFormation.deployStack.mockImplementation((options) => Promise.resolve({
Expand Down Expand Up @@ -486,6 +486,7 @@ describe('nested stacks', () => {
const exitCode = await toolkit.diff({
stackNames: ['Parent'],
stream: buffer,
changeSet: false,
});

// THEN
Expand Down

0 comments on commit b4f04e5

Please sign in to comment.