@@ -325,6 +325,51 @@ describe("BundlePusher01", () => {
325
325
expect ( readSpy ) . toHaveBeenCalledTimes ( 1 ) ;
326
326
expect ( uploadSpy ) . toHaveBeenCalledTimes ( 1 ) ;
327
327
} ) ;
328
+ it ( "should handle custom bundle id" , async ( ) => {
329
+ uploadSpy . mockImplementationOnce ( ( ) => { throw new Error ( "Injected upload error" ) ; } ) ;
330
+ readSpy = jest . spyOn ( fs , "readFileSync" ) . mockImplementation ( ( data : string ) => {
331
+ if ( data . indexOf ( "cics.xml" ) > - 1 ) {
332
+ return "<manifest xmlns=\"http://www.ibm.com/xmlns/prod/cics/bundle\" id=\"InjectedBundleId\" ></manifest>" ;
333
+ }
334
+ } ) ;
335
+
336
+ await runPushTestWithError ( "__tests__/__resources__/ExampleBundle01" , false ,
337
+ "A problem occurred uploading the bundle to the remote directory '/u/ThisDoesNotExist/InjectedBundleId_1.0.0'. Problem is: Injected upload error" ) ;
338
+
339
+ expect ( zosMFSpy ) . toHaveBeenCalledTimes ( 1 ) ;
340
+ expect ( sshSpy ) . toHaveBeenCalledTimes ( 1 ) ;
341
+ expect ( listSpy ) . toHaveBeenCalledTimes ( 1 ) ;
342
+ expect ( createSpy ) . toHaveBeenCalledTimes ( 1 ) ;
343
+ expect ( shellSpy ) . toHaveBeenCalledTimes ( 0 ) ;
344
+ expect ( membersSpy ) . toHaveBeenCalledTimes ( 0 ) ;
345
+ expect ( submitSpy ) . toHaveBeenCalledTimes ( 0 ) ;
346
+ expect ( existsSpy ) . toHaveBeenCalledTimes ( 1 ) ;
347
+ expect ( readSpy ) . toHaveBeenCalledTimes ( 1 ) ;
348
+ expect ( uploadSpy ) . toHaveBeenCalledTimes ( 1 ) ;
349
+ } ) ;
350
+ it ( "should handle custom bundle id and version" , async ( ) => {
351
+ uploadSpy . mockImplementationOnce ( ( ) => { throw new Error ( "Injected upload error" ) ; } ) ;
352
+ readSpy = jest . spyOn ( fs , "readFileSync" ) . mockImplementation ( ( data : string ) => {
353
+ if ( data . indexOf ( "cics.xml" ) > - 1 ) {
354
+ return "<manifest xmlns=\"http://www.ibm.com/xmlns/prod/cics/bundle\" id=\"InjectedBundleId\" " +
355
+ " bundleMajorVer=\"33\" bundleMinorVer=\"22\" bundleMicroVer=\"11\"></manifest>" ;
356
+ }
357
+ } ) ;
358
+
359
+ await runPushTestWithError ( "__tests__/__resources__/ExampleBundle01" , false ,
360
+ "A problem occurred uploading the bundle to the remote directory '/u/ThisDoesNotExist/InjectedBundleId_33.22.11'. Problem is: Injected upload error" ) ;
361
+
362
+ expect ( zosMFSpy ) . toHaveBeenCalledTimes ( 1 ) ;
363
+ expect ( sshSpy ) . toHaveBeenCalledTimes ( 1 ) ;
364
+ expect ( listSpy ) . toHaveBeenCalledTimes ( 1 ) ;
365
+ expect ( createSpy ) . toHaveBeenCalledTimes ( 1 ) ;
366
+ expect ( shellSpy ) . toHaveBeenCalledTimes ( 0 ) ;
367
+ expect ( membersSpy ) . toHaveBeenCalledTimes ( 0 ) ;
368
+ expect ( submitSpy ) . toHaveBeenCalledTimes ( 0 ) ;
369
+ expect ( existsSpy ) . toHaveBeenCalledTimes ( 1 ) ;
370
+ expect ( readSpy ) . toHaveBeenCalledTimes ( 1 ) ;
371
+ expect ( uploadSpy ) . toHaveBeenCalledTimes ( 1 ) ;
372
+ } ) ;
328
373
it ( "should handle error with remote npm install" , async ( ) => {
329
374
shellSpy . mockImplementation ( ( session : any , cmd : string ) => {
330
375
if ( cmd . indexOf ( "npm install" ) > - 1 ) {
0 commit comments