Skip to content

Commit 32e1556

Browse files
committed
add unit test to coverage
1 parent c3ce6f6 commit 32e1556

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

packages/aws-cdk/test/cli/cdk-toolkit.test.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1208,6 +1208,23 @@ describe('destroy', () => {
12081208
]);
12091209
});
12101210

1211+
test('warns if there are only non-existent stacks even when exclusively is false', async () => {
1212+
const toolkit = defaultToolkitSetup();
1213+
1214+
await toolkit.destroy({
1215+
selector: { patterns: ['Test-Stack-X', 'Test-Stack-Y'] },
1216+
exclusively: false,
1217+
force: true,
1218+
fromDeploy: true,
1219+
});
1220+
1221+
expect(flatten(notifySpy.mock.calls)).toEqual([
1222+
expectIoMsg(expect.stringContaining(`${chalk.red('Test-Stack-X')} does not exist.`), 'warn'),
1223+
expectIoMsg(expect.stringContaining(`${chalk.red('Test-Stack-Y')} does not exist.`), 'warn'),
1224+
expectIoMsg(expect.stringContaining(`No stacks match the name(s): ${chalk.red('Test-Stack-X, Test-Stack-Y')}`), 'warn'),
1225+
]);
1226+
});
1227+
12111228
test('warns if there is a non-existent stack and the other exists', async () => {
12121229
const toolkit = defaultToolkitSetup();
12131230

0 commit comments

Comments
 (0)