@@ -33,10 +33,13 @@ describe('bin/destroy.ts', () => {
3333 const propsPath = path . join ( buildDir , '.adapterprops.json' )
3434
3535 const expectedStackName = 'mock'
36- const expectedPulumiPath = 'mock/pulumi'
36+ const expectedPulumiPaths = [
37+ 'stacks/one' ,
38+ 'stacks/two'
39+ ]
3740 const json = JSON . stringify ( {
3841 stackName : expectedStackName ,
39- pulumiPath : expectedPulumiPath ,
42+ pulumiPaths : expectedPulumiPaths ,
4043 } )
4144 fs . writeFileSync ( propsPath , json )
4245
@@ -51,13 +54,13 @@ describe('bin/destroy.ts', () => {
5154 let spawnSyncMock = < any > spawnSync
5255 const args = spawnSyncMock . mock . calls [ 0 ]
5356
54- expect ( spawnSync ) . toHaveBeenCalledTimes ( 1 )
57+ expect ( spawnSync ) . toHaveBeenCalledTimes ( 2 )
5558 expect ( args ) . toEqual (
5659 expect . arrayContaining ( [
5760 'pulumi' ,
58- [ 'destroy' , '-f' , '-s' , expectedStackName , '-y' ] ,
61+ [ 'destroy' , '-f' , '-s' , expectedStackName , '-y' , '--refresh' ] ,
5962 expect . objectContaining ( {
60- cwd : expectedPulumiPath ,
63+ cwd : expectedPulumiPaths [ 0 ] ,
6164 } ) ,
6265 ] )
6366 )
@@ -68,10 +71,13 @@ describe('bin/destroy.ts', () => {
6871 const propsPath = path . join ( tmpDir , '.adapterprops.json' )
6972
7073 const expectedStackName = 'mock'
71- const expectedPulumiPath = 'mock/pulumi'
74+ const expectedPulumiPaths = [
75+ 'stacks/one' ,
76+ 'stacks/two'
77+ ]
7278 const json = JSON . stringify ( {
7379 stackName : expectedStackName ,
74- pulumiPath : expectedPulumiPath ,
80+ pulumiPaths : expectedPulumiPaths ,
7581 } )
7682 fs . writeFileSync ( propsPath , json )
7783
@@ -83,13 +89,13 @@ describe('bin/destroy.ts', () => {
8389 let spawnSyncMock = < any > spawnSync
8490 const args = spawnSyncMock . mock . calls [ 0 ]
8591
86- expect ( spawnSync ) . toHaveBeenCalledTimes ( 1 )
92+ expect ( spawnSync ) . toHaveBeenCalledTimes ( 2 )
8793 expect ( args ) . toEqual (
8894 expect . arrayContaining ( [
8995 'pulumi' ,
90- [ 'destroy' , '-f' , '-s' , expectedStackName , '-y' ] ,
96+ [ 'destroy' , '-f' , '-s' , expectedStackName , '-y' , '--refresh' ] ,
9197 expect . objectContaining ( {
92- cwd : expectedPulumiPath ,
98+ cwd : expectedPulumiPaths [ 0 ] ,
9399 } ) ,
94100 ] )
95101 )
0 commit comments