@@ -35,33 +35,23 @@ import { ExactModule } from '@jspm/generator/lib/install/package';
35
35
36
36
test ( "ensureDirSync has dir" , ( ) => {
37
37
const dir = "/path/to/dir" ;
38
- const existsSyncMock = jest . spyOn ( fs , 'existsSync' ) . mockReturnValue ( true ) ;
39
38
const dirnameMock = jest . spyOn ( path , 'dirname' )
40
39
ensureDirSync ( dir ) ;
41
- expect ( existsSyncMock ) . toBeCalledWith ( dir ) ;
42
40
expect ( dirnameMock ) . not . toBeCalled ( ) ;
43
41
} ) ;
44
42
45
43
test ( "ensureDirSync has parent dir" , ( ) => {
46
44
const dir = "/path/to/dir" ;
47
- const existsSyncMock = jest . spyOn ( fs , 'existsSync' ) . mockReturnValue ( false ) ;
48
- const dirnameMock = jest . spyOn ( path , 'dirname' ) . mockReturnValue ( "/path/to/dir" ) ;
49
45
const mkdirSyncMock = jest . spyOn ( fs , 'mkdirSync' )
50
46
ensureDirSync ( dir ) ;
51
- expect ( existsSyncMock ) . toBeCalledWith ( dir ) ;
52
- expect ( dirnameMock ) . toBeCalledWith ( dir ) ;
53
47
expect ( mkdirSyncMock ) . toHaveBeenCalledTimes ( 1 ) ;
54
48
} ) ;
55
49
56
50
test ( "ensureDirSync to have recursion" , ( ) => {
57
51
const dir = "/path/to/dir" ;
58
- const existsSyncMock = jest . spyOn ( fs , 'existsSync' ) . mockReturnValue ( false ) ;
59
- const dirnameMock = jest . spyOn ( path , 'dirname' ) . mockReturnValue ( "/path/" ) ;
60
52
const mkdirSyncMock = jest . spyOn ( fs , 'mkdirSync' )
61
53
ensureDirSync ( dir ) ;
62
- expect ( existsSyncMock ) . toBeCalledWith ( dir ) ;
63
- expect ( dirnameMock ) . toBeCalledWith ( dir ) ;
64
- expect ( mkdirSyncMock ) . toHaveBeenCalledTimes ( 2 ) ;
54
+ expect ( mkdirSyncMock ) . toHaveBeenCalledTimes ( 1 ) ;
65
55
} ) ;
66
56
67
57
test ( "ensureFileSync has file" , ( ) => {
0 commit comments