diff --git a/packages/aws-cdk-lib/assertions/test/template.test.ts b/packages/aws-cdk-lib/assertions/test/template.test.ts index 46f4df1b4356e..831e58a0e4ca5 100644 --- a/packages/aws-cdk-lib/assertions/test/template.test.ts +++ b/packages/aws-cdk-lib/assertions/test/template.test.ts @@ -1368,6 +1368,27 @@ describe('Template', () => { }).toThrow(/dependency cycle/); }); + test('throws when given a template with cyclic dependencies if a skip flag is false', () => { + expect(() => { + Template.fromJSON({ + Resources: { + Res1: { + Type: 'Foo', + Properties: { + Thing: { Ref: 'Res2' }, + }, + }, + Res2: { + Type: 'Foo', + DependsOn: ['Res1'], + }, + }, + }, { + skipCyclicalDependenciesCheck: false, + }); + }).toThrow(/dependency cycle/); + }); + test('does not throw when given a template with cyclic dependencies if check is skipped', () => { expect(() => { Template.fromJSON({