@@ -45,20 +45,15 @@ describe('type: fileLocation', () => {
4545 'returned JSON was not equal expected'
4646 ) ;
4747 assert . deepEqual (
48- await testUtils . getActualJson ( 'testExisting_fileLocation_gcp ' , 'fileLocation' ) ,
49- await testUtils . getExpectedJson ( '9999999' , 'fileLocation' , 'get-gcp ' ) ,
48+ await testUtils . getActualJson ( 'testExisting_fileLocation_azure ' , 'fileLocation' ) ,
49+ await testUtils . getExpectedJson ( '9999999' , 'fileLocation' , 'get-azure ' ) ,
5050 'returned JSON was not equal expected'
5151 ) ;
5252 assert . deepEqual (
5353 await testUtils . getActualJson ( 'testExisting_fileLocation_aws' , 'fileLocation' ) ,
5454 await testUtils . getExpectedJson ( '9999999' , 'fileLocation' , 'get-aws' ) ,
5555 'returned JSON was not equal expected'
5656 ) ;
57- assert . deepEqual (
58- await testUtils . getActualJson ( 'testExisting_fileLocation_azure' , 'fileLocation' ) ,
59- await testUtils . getExpectedJson ( '9999999' , 'fileLocation' , 'get-azure' ) ,
60- 'returned JSON was not equal expected'
61- ) ;
6257 assert . deepEqual (
6358 await testUtils . getActualJson ( 'testExisting_fileLocation_exsftp' , 'fileLocation' ) ,
6459 await testUtils . getExpectedJson ( '9999999' , 'fileLocation' , 'get-exsftp' ) ,
@@ -138,9 +133,13 @@ describe('type: fileLocation', () => {
138133
139134 it ( 'Should update fileLocations' , async ( ) => {
140135 // WHEN
141- const deployed = await handler . deploy ( 'testInstance/testBU' , [ 'fileLocation' ] ) ;
136+ const deployed = await handler . deploy (
137+ 'testInstance/testBU' ,
138+ [ 'fileLocation' ] ,
139+ [ 'testExisting_fileLocation_exsftp' , 'testExisting_fileLocation_aws' ]
140+ ) ;
142141 // THEN
143- assert . equal ( process . exitCode , 1 , 'deploy should not have thrown an error' ) ;
142+ assert . equal ( process . exitCode , 0 , 'deploy should not have thrown an error' ) ;
144143 // get results from cache
145144 const result = cache . getCache ( ) ;
146145 assert . equal (
@@ -156,6 +155,9 @@ describe('type: fileLocation', () => {
156155 'unexpected number of fileLocations deployed'
157156 ) ;
158157 // confirm created item
158+ // TODO
159+
160+ // confirm updated item
159161 assert . deepEqual (
160162 await testUtils . getActualJson ( 'testExisting_fileLocation_exsftp' , 'fileLocation' ) ,
161163 await testUtils . getExpectedJson ( '9999999' , 'fileLocation' , 'patch-exsftp' ) ,
@@ -175,6 +177,39 @@ describe('type: fileLocation', () => {
175177 ) ;
176178 return ;
177179 } ) ;
180+
181+ it ( 'Should not update fileLocations' , async ( ) => {
182+ // WHEN
183+ const deployed = await handler . deploy (
184+ 'testInstance/testBU' ,
185+ [ 'fileLocation' ] ,
186+ [ 'ExactTarget Enhanced FTP' ]
187+ ) ;
188+ // THEN
189+ assert . equal ( process . exitCode , 1 , 'deploy should have thrown an error' ) ;
190+ // get results from cache
191+ const result = cache . getCache ( ) ;
192+ assert . equal (
193+ result . fileLocation ? Object . keys ( result . fileLocation ) . length : 0 ,
194+ 6 ,
195+ 'unexpected number of fileLocations in cache'
196+ ) ;
197+ assert . equal (
198+ deployed ?. [ 'testInstance/testBU' ] ?. fileLocation
199+ ? Object . keys ( deployed [ 'testInstance/testBU' ] . fileLocation ) . length
200+ : 0 ,
201+ 0 ,
202+ 'unexpected number of fileLocations deployed'
203+ ) ;
204+
205+ // check number of API calls
206+ assert . equal (
207+ testUtils . getAPIHistoryLength ( ) ,
208+ 2 ,
209+ 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
210+ ) ;
211+ return ;
212+ } ) ;
178213 } ) ;
179214
180215 describe ( 'Templating ================' , ( ) => {
0 commit comments