1
+ import path from 'path' ;
1
2
import { writeFiles , getTempDirectory , cleanup } from '../../../../jest/helpers' ;
2
3
import installPods from '../tools/installPods' ;
3
4
import resolvePods , {
@@ -51,6 +52,7 @@ const DIR = getTempDirectory('root_test');
51
52
const createTempFiles = ( rest ?: Record < string , string > ) => {
52
53
writeFiles ( DIR , {
53
54
'package.json' : JSON . stringify ( packageJson ) ,
55
+ 'ios/Podfile' : '' ,
54
56
...rest ,
55
57
} ) ;
56
58
} ;
@@ -83,25 +85,27 @@ describe('getPlatformDependencies', () => {
83
85
84
86
describe ( 'resolvePods' , ( ) => {
85
87
it ( 'should install pods if they are not installed' , async ( ) => {
86
- createTempFiles ( { 'ios/Podfile/Manifest.lock' : '' } ) ;
88
+ createTempFiles ( ) ;
87
89
88
- await resolvePods ( DIR , { } , 'ios' ) ;
90
+ await resolvePods ( DIR , path . join ( DIR , 'ios' ) , { } , 'ios' ) ;
89
91
90
92
expect ( installPods ) . toHaveBeenCalled ( ) ;
91
93
} ) ;
92
94
93
95
it ( 'should install pods when force option is set to true' , async ( ) => {
94
96
createTempFiles ( ) ;
95
97
96
- await resolvePods ( DIR , { } , 'ios' , { forceInstall : true } ) ;
98
+ await resolvePods ( DIR , path . join ( DIR , 'ios' ) , { } , 'ios' , {
99
+ forceInstall : true ,
100
+ } ) ;
97
101
98
102
expect ( installPods ) . toHaveBeenCalled ( ) ;
99
103
} ) ;
100
104
101
105
it ( 'should install pods when there is no cached hash of dependencies' , async ( ) => {
102
106
createTempFiles ( ) ;
103
107
104
- await resolvePods ( DIR , { } , 'ios' ) ;
108
+ await resolvePods ( DIR , path . join ( DIR , 'ios' ) , { } , 'ios' ) ;
105
109
106
110
expect ( mockSet ) . toHaveBeenCalledWith (
107
111
packageJson . name ,
@@ -111,22 +115,26 @@ describe('resolvePods', () => {
111
115
} ) ;
112
116
113
117
it ( 'should skip pods installation if the cached hash and current hash are the same' , async ( ) => {
114
- createTempFiles ( { 'ios/Pods/Manifest.lock' : '' } ) ;
118
+ createTempFiles ( {
119
+ 'ios/Pods/Manifest.lock' : '' ,
120
+ 'ios/Podfile.lock' : `PODFILE CHECKSUM: ${ dependencyHash } ` ,
121
+ } ) ;
115
122
116
123
mockGet . mockImplementation ( ( ) => dependencyHash ) ;
117
124
118
- await resolvePods ( DIR , { } , 'ios' ) ;
125
+ await resolvePods ( DIR , path . join ( DIR , 'ios' ) , { } , 'ios' ) ;
119
126
120
127
expect ( installPods ) . not . toHaveBeenCalled ( ) ;
121
128
} ) ;
122
129
123
130
it ( 'should install pods if the cached hash and current hash are different' , async ( ) => {
124
- createTempFiles ( { 'ios/Pods/Manifest.lock' : '' } ) ;
131
+ createTempFiles ( ) ;
125
132
126
133
mockGet . mockImplementation ( ( ) => dependencyHash ) ;
127
134
128
135
await resolvePods (
129
136
DIR ,
137
+ path . join ( DIR , 'ios' ) ,
130
138
{
131
139
dep1 : {
132
140
name : 'dep1' ,
0 commit comments