@@ -7,30 +7,39 @@ jest.mock('fs');
77
88const fs = require ( 'fs' ) ;
99
10- afterEach ( ( ) => {
11- jest . resetAllMocks ( ) ;
12- } ) ;
13-
1410describe ( 'ios::findPodfilePath' , ( ) => {
11+ beforeAll ( ( ) => {
12+ fs . __setMockFilesystem ( {
13+ empty : { } ,
14+ flat : {
15+ ...projects . project ,
16+ } ,
17+ multiple : {
18+ bar : {
19+ ...projects . project ,
20+ } ,
21+ foo : {
22+ ...projects . project ,
23+ } ,
24+ } ,
25+ } ) ;
26+ } ) ;
27+
1528 it ( 'returns null if there is no Podfile' , ( ) => {
16- fs . __setMockFilesystem ( { } ) ;
17- expect ( findPodfilePath ( '/' , 'ios' ) ) . toBeNull ( ) ;
29+ expect ( findPodfilePath ( '/empty' , 'ios' ) ) . toBeNull ( ) ;
1830 } ) ;
1931
2032 it ( 'returns Podfile path if it exists' , ( ) => {
21- fs . __setMockFilesystem ( projects . project ) ;
22- expect ( findPodfilePath ( '/' , 'ios' ) ) . toContain ( 'ios/Podfile' ) ;
33+ expect ( findPodfilePath ( '/flat' , 'ios' ) ) . toContain ( 'ios/Podfile' ) ;
2334 } ) ;
2435
2536 it ( 'prints a warning when multile Podfiles are found' , ( ) => {
2637 const warn = jest . spyOn ( logger , 'warn' ) . mockImplementation ( ) ;
27- fs . __setMockFilesystem ( {
28- foo : projects . project ,
29- bar : projects . project ,
30- } ) ;
31- expect ( findPodfilePath ( '/' , 'ios' ) ) . toContain ( 'bar/ios/Podfile' ) ;
38+ expect ( findPodfilePath ( '/multiple' , 'ios' ) ) . toContain (
39+ '/multiple/bar/ios/Podfile' ,
40+ ) ;
3241 expect ( warn . mock . calls ) . toMatchSnapshot ( ) ;
3342 } ) ;
3443
35- it ( 'igores Podfiles in Example folder' , ( ) => { } ) ;
44+ it ( 'ignores Podfiles in Example folder' , ( ) => { } ) ;
3645} ) ;
0 commit comments