Skip to content

Commit 0042700

Browse files
committed
Fix tests
1 parent ae8ddcf commit 0042700

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

tests/unit/android.test.js

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ function normalizePath(filePath) {
77
return filePath.replace(/\\/g, '/');
88
}
99

10+
// Add this helper function
11+
function normalizeChange(change) {
12+
return {
13+
...change,
14+
file: normalizePath(change.file),
15+
};
16+
}
17+
1018
describe('Android Version Updates', () => {
1119
let tempDir, cleanup;
1220

@@ -222,17 +230,17 @@ describe('Android Version Updates', () => {
222230
const versionCodeChange = options.changes.find((c) => c.item === 'versionCode');
223231
const versionNameChange = options.changes.find((c) => c.item === 'versionName');
224232

225-
expect(versionCodeChange).toEqual({
233+
expect(normalizeChange(versionCodeChange)).toEqual({
226234
platform: 'Android',
227-
file: normalizePath(versionCodeChange.file), // Normalize the actual received value
235+
file: 'android/app/build.gradle',
228236
item: 'versionCode',
229237
oldValue: '1',
230238
newValue: 2,
231239
});
232240

233-
expect(versionNameChange).toEqual({
241+
expect(normalizeChange(versionNameChange)).toEqual({
234242
platform: 'Android',
235-
file: normalizePath(versionNameChange.file), // Normalize the actual received value
243+
file: 'android/app/build.gradle',
236244
item: 'versionName',
237245
oldValue: '1.0.0',
238246
newValue: '1.0.1',
@@ -304,7 +312,7 @@ describe('Android Version Updates', () => {
304312
projectRoot: tempDir,
305313
changes: [],
306314
increment: 'minor',
307-
packageJsonPath: packageJsonPath,
315+
packageJsonPath,
308316
packageJsonUpdated: false,
309317
};
310318

@@ -334,7 +342,7 @@ describe('Android Version Updates', () => {
334342
projectRoot: tempDir,
335343
changes: [],
336344
increment: 'minor',
337-
packageJsonPath: packageJsonPath,
345+
packageJsonPath,
338346
packageJsonUpdated: true, // already updated
339347
};
340348

tests/unit/ios.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,15 +225,15 @@ describe('iOS Version Updates', () => {
225225

226226
expect(normalizeChange(currentProjectVersionChange)).toEqual({
227227
platform: 'iOS',
228-
file: normalizePath(currentProjectVersionChange.file), // Normalize the actual received value
228+
file: 'ios/TestRNApp.xcodeproj/project.pbxproj',
229229
item: 'CURRENT_PROJECT_VERSION',
230230
oldValue: '1',
231231
newValue: 2,
232232
});
233233

234234
expect(normalizeChange(marketingVersionChange)).toEqual({
235235
platform: 'iOS',
236-
file: normalizePath(marketingVersionChange.file), // Normalize the actual received value
236+
file: 'ios/TestRNApp.xcodeproj/project.pbxproj',
237237
item: 'MARKETING_VERSION',
238238
oldValue: '1.0.0',
239239
newValue: '1.0.1',
@@ -335,7 +335,7 @@ describe('iOS Version Updates', () => {
335335
projectRoot: tempDir,
336336
changes: [],
337337
increment: 'minor',
338-
packageJsonPath: packageJsonPath,
338+
packageJsonPath,
339339
packageJsonUpdated: true, // already updated
340340
};
341341

0 commit comments

Comments
 (0)