Skip to content

Commit bc02e8e

Browse files
committed
fix: sync unit tests with current impl
1 parent b99f2bc commit bc02e8e

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

packages/cli-platform-apple/src/__tests__/pods.test.ts

+15-7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import path from 'path';
12
import {writeFiles, getTempDirectory, cleanup} from '../../../../jest/helpers';
23
import installPods from '../tools/installPods';
34
import resolvePods, {
@@ -51,6 +52,7 @@ const DIR = getTempDirectory('root_test');
5152
const createTempFiles = (rest?: Record<string, string>) => {
5253
writeFiles(DIR, {
5354
'package.json': JSON.stringify(packageJson),
55+
'ios/Podfile': '',
5456
...rest,
5557
});
5658
};
@@ -83,25 +85,27 @@ describe('getPlatformDependencies', () => {
8385

8486
describe('resolvePods', () => {
8587
it('should install pods if they are not installed', async () => {
86-
createTempFiles({'ios/Podfile/Manifest.lock': ''});
88+
createTempFiles();
8789

88-
await resolvePods(DIR, {}, 'ios');
90+
await resolvePods(DIR, path.join(DIR, 'ios'), {}, 'ios');
8991

9092
expect(installPods).toHaveBeenCalled();
9193
});
9294

9395
it('should install pods when force option is set to true', async () => {
9496
createTempFiles();
9597

96-
await resolvePods(DIR, {}, 'ios', {forceInstall: true});
98+
await resolvePods(DIR, path.join(DIR, 'ios'), {}, 'ios', {
99+
forceInstall: true,
100+
});
97101

98102
expect(installPods).toHaveBeenCalled();
99103
});
100104

101105
it('should install pods when there is no cached hash of dependencies', async () => {
102106
createTempFiles();
103107

104-
await resolvePods(DIR, {}, 'ios');
108+
await resolvePods(DIR, path.join(DIR, 'ios'), {}, 'ios');
105109

106110
expect(mockSet).toHaveBeenCalledWith(
107111
packageJson.name,
@@ -111,22 +115,26 @@ describe('resolvePods', () => {
111115
});
112116

113117
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+
});
115122

116123
mockGet.mockImplementation(() => dependencyHash);
117124

118-
await resolvePods(DIR, {}, 'ios');
125+
await resolvePods(DIR, path.join(DIR, 'ios'), {}, 'ios');
119126

120127
expect(installPods).not.toHaveBeenCalled();
121128
});
122129

123130
it('should install pods if the cached hash and current hash are different', async () => {
124-
createTempFiles({'ios/Pods/Manifest.lock': ''});
131+
createTempFiles();
125132

126133
mockGet.mockImplementation(() => dependencyHash);
127134

128135
await resolvePods(
129136
DIR,
137+
path.join(DIR, 'ios'),
130138
{
131139
dep1: {
132140
name: 'dep1',

0 commit comments

Comments
 (0)