Skip to content

Commit

Permalink
diff template test
Browse files Browse the repository at this point in the history
  • Loading branch information
comcalvi committed Jan 19, 2024
1 parent 9d94391 commit 06cc799
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions packages/@aws-cdk/cloudformation-diff/test/diff-template.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1117,4 +1117,40 @@ describe('changeset', () => {
});
expect(differences.resources.differenceCount).toBe(1);
});

test('imports are respected', async () => {
// GIVEN
const currentTemplate = {
Resources: {
BucketResource: {
Type: 'AWS::S3::Bucket',
BucketName: 'Foo',
},
},
};

// WHEN
const newTemplate = {
Resources: {
BucketResource: {
Type: 'AWS::S3::Bucket',
BucketName: 'Bar',
},
},
};

let differences = fullDiff(currentTemplate, newTemplate, {
Changes: [
{
Type: 'Resource',
ResourceChange: {
Action: 'Import',
LogicalResourceId: 'BucketResource',
},
},
],
});
expect(differences.resources.differenceCount).toBe(1);
expect(differences.resources.get('BucketResource').changeImpact === ResourceImpact.WILL_IMPORT);
});
});

0 comments on commit 06cc799

Please sign in to comment.