Skip to content

Commit 483caeb

Browse files
committed
add extra tests
1 parent b780971 commit 483caeb

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

packages/cli-config-android/src/config/__fixtures__/android.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,19 @@ function generateValidFileStructureForApp() {
7171
};
7272
}
7373

74+
function generateValidFileStructureForAppWithCustomAppName(
75+
customAppName: string,
76+
) {
77+
return {
78+
'build.gradle': buildGradle,
79+
[customAppName]: {
80+
'build.gradle': appBuildGradle,
81+
},
82+
src: {
83+
'AndroidManifest.xml': manifest,
84+
},
85+
};
86+
}
7487
export const valid = generateValidFileStructureForLib('ReactPackage.java');
7588

7689
export const validKotlin = generateValidFileStructureForLib('ReactPackage.kt');
@@ -83,6 +96,9 @@ export const validKotlinWithDifferentFileName =
8396

8497
export const validApp = generateValidFileStructureForApp();
8598

99+
export const validAppWithCustomAppName =
100+
generateValidFileStructureForAppWithCustomAppName('custom');
101+
86102
export const userConfigManifest = {
87103
src: {
88104
main: {

packages/cli-config-android/src/config/__tests__/findBuildGradle.test.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ describe('findBuildGradle for apps', () => {
2121
flat: {
2222
android: mocks.validApp,
2323
},
24+
customPath: {
25+
android: mocks.validAppWithCustomAppName,
26+
},
2427
});
2528
});
2629

@@ -33,6 +36,12 @@ describe('findBuildGradle for apps', () => {
3336
it('returns `null` if there is no gradle in the app folder', () => {
3437
expect(findBuildGradle('/empty', 'app')).toBeNull();
3538
});
39+
40+
it('returns the app build.gradle with custom app name', () => {
41+
expect(findBuildGradle('/customPath/android', 'custom')).toBe(
42+
'/customPath/android/custom/build.gradle',
43+
);
44+
});
3645
});
3746

3847
describe('findBuildGradle for libraries', () => {

0 commit comments

Comments
 (0)