mirror of
https://github.com/apache/cordova-android.git
synced 2026-04-04 00:02:03 +08:00
feat(android-studio): display app name as project name (#1173)
* (android) Feature: Write name of the Android app to .idea/.name for Android Studio #1172 * Missing space before function parentheses. * Add test for writeNameForAndroidStudio #1172 * Use ES6 for new code. Code DRYness in test spec. #1172
This commit is contained in:
@@ -132,6 +132,7 @@ describe('create', function () {
|
||||
spyOn(create, 'copyBuildRules');
|
||||
spyOn(create, 'writeProjectProperties');
|
||||
spyOn(create, 'prepBuildFiles');
|
||||
spyOn(create, 'writeNameForAndroidStudio');
|
||||
revert_manifest_mock = create.__set__('AndroidManifest', Manifest_mock);
|
||||
spyOn(fs, 'existsSync').and.returnValue(false);
|
||||
spyOn(fs, 'copySync');
|
||||
@@ -300,4 +301,24 @@ describe('create', function () {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('writeNameForAndroidStudio', () => {
|
||||
const project_path = path.join('some', 'path');
|
||||
const appName = 'Test Cordova';
|
||||
|
||||
beforeEach(function () {
|
||||
spyOn(fs, 'ensureDirSync');
|
||||
spyOn(fs, 'writeFileSync');
|
||||
});
|
||||
|
||||
it('should call ensureDirSync with path', () => {
|
||||
create.writeNameForAndroidStudio(project_path, appName);
|
||||
expect(fs.ensureDirSync).toHaveBeenCalledWith(path.join(project_path, '.idea'));
|
||||
});
|
||||
|
||||
it('should call writeFileSync with content', () => {
|
||||
create.writeNameForAndroidStudio(project_path, appName);
|
||||
expect(fs.writeFileSync).toHaveBeenCalledWith(path.join(project_path, '.idea', '.name'), appName);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user