@@ -22,7 +22,16 @@ describe("MockedFilesystemTests", () => {
22
22
23
23
it ( "should tolerate META-INF directory not existing" , ( ) => {
24
24
// Mocks for the manifest - META-INF exists
25
- jest . spyOn ( fs , "existsSync" ) . mockImplementationOnce ( ( ) => ( false ) ) ;
25
+ jest . spyOn ( fs , "existsSync" ) . mockImplementation ( ( path : string ) => {
26
+ if ( path . endsWith ( "META-INF" ) ) {
27
+ return false ;
28
+ }
29
+ if ( path . endsWith ( ".zosattributes" ) ) {
30
+ return false ;
31
+ }
32
+ return true ;
33
+ } ) ;
34
+
26
35
// Mocks for the manifest - Bundle dir writable
27
36
jest . spyOn ( fs , "accessSync" ) . mockImplementationOnce ( ( ) => ( true ) ) ;
28
37
@@ -355,6 +364,9 @@ describe("MockedFilesystemTests", () => {
355
364
}
356
365
return true ;
357
366
} ) ;
367
+ jest . spyOn ( fs , "writeFileSync" ) . mockImplementation ( ( path : string ) => {
368
+ return true ;
369
+ } ) ;
358
370
359
371
jest . spyOn ( fs , "mkdirSync" ) . mockImplementationOnce ( ( ) => { throw new Error ( "InjectedError" ) ; } ) ;
360
372
@@ -383,7 +395,11 @@ describe("MockedFilesystemTests", () => {
383
395
} ) ;
384
396
385
397
// Mocks for the manifest - manifest write
386
- jest . spyOn ( fs , "writeFileSync" ) . mockImplementationOnce ( ( ) => { throw new Error ( "InjectedError" ) ; } ) ;
398
+ jest . spyOn ( fs , "writeFileSync" ) . mockImplementation ( ( path : string ) => {
399
+ if ( path . endsWith ( "cics.xml" ) ) {
400
+ throw new Error ( "InjectedError" ) ;
401
+ }
402
+ } ) ;
387
403
388
404
389
405
let err : Error ;
@@ -408,6 +424,9 @@ describe("MockedFilesystemTests", () => {
408
424
}
409
425
return true ;
410
426
} ) ;
427
+ jest . spyOn ( fs , "writeFileSync" ) . mockImplementation ( ( path : string ) => {
428
+ return true ;
429
+ } ) ;
411
430
412
431
jest . spyOn ( fs , "mkdirSync" ) . mockImplementationOnce ( ( ) => { throw new Error ( "InjectedError" ) ; } ) ;
413
432
@@ -434,9 +453,11 @@ describe("MockedFilesystemTests", () => {
434
453
}
435
454
return true ;
436
455
} ) ;
437
-
438
- // Mocks for the nodejsapp - write .nodejsapp file)
439
- jest . spyOn ( fs , "writeFileSync" ) . mockImplementationOnce ( ( ) => { throw new Error ( "InjectedError" ) ; } ) ;
456
+ jest . spyOn ( fs , "writeFileSync" ) . mockImplementation ( ( path : string ) => {
457
+ if ( path . endsWith ( ".nodejsapp" ) ) {
458
+ throw new Error ( "InjectedError" ) ;
459
+ }
460
+ } ) ;
440
461
441
462
let err : Error ;
442
463
try {
0 commit comments