mirror of
https://github.com/apache/cordova-android.git
synced 2026-04-23 00:00:09 +08:00
chore(npm): bump @cordova/eslint-config@^4.0.0 (#1421)
* chore(npm): bump @cordova/eslint-config@^4.0.0 * style(lint): apply auto corrections * style(lint): convert hasAndroidHome var to let and hoisted
This commit is contained in:
+11
-11
@@ -17,29 +17,29 @@
|
||||
under the License.
|
||||
*/
|
||||
|
||||
var os = require('os');
|
||||
var path = require('path');
|
||||
var common = require('cordova-common');
|
||||
const os = require('os');
|
||||
const path = require('path');
|
||||
const common = require('cordova-common');
|
||||
const EventEmitter = require('events');
|
||||
|
||||
var Api = require('../../lib/Api');
|
||||
var AndroidProject = require('../../lib/AndroidProject');
|
||||
const Api = require('../../lib/Api');
|
||||
const AndroidProject = require('../../lib/AndroidProject');
|
||||
|
||||
var PluginInfo = common.PluginInfo;
|
||||
const PluginInfo = common.PluginInfo;
|
||||
|
||||
var FIXTURES = path.join(__dirname, '../e2e/fixtures');
|
||||
var FAKE_PROJECT_DIR = path.join(os.tmpdir(), 'plugin-test-project');
|
||||
const FIXTURES = path.join(__dirname, '../e2e/fixtures');
|
||||
const FAKE_PROJECT_DIR = path.join(os.tmpdir(), 'plugin-test-project');
|
||||
|
||||
describe('Api', () => {
|
||||
describe('addPlugin method', function () {
|
||||
var api;
|
||||
let api;
|
||||
|
||||
beforeEach(function () {
|
||||
var pluginManager = jasmine.createSpyObj('pluginManager', ['addPlugin']);
|
||||
const pluginManager = jasmine.createSpyObj('pluginManager', ['addPlugin']);
|
||||
pluginManager.addPlugin.and.resolveTo();
|
||||
spyOn(common.PluginManager, 'get').and.returnValue(pluginManager);
|
||||
|
||||
var projectSpy = jasmine.createSpyObj('AndroidProject', ['getPackageName', 'write', 'isClean']);
|
||||
const projectSpy = jasmine.createSpyObj('AndroidProject', ['getPackageName', 'write', 'isClean']);
|
||||
spyOn(AndroidProject, 'getProjectFile').and.returnValue(projectSpy);
|
||||
|
||||
api = new Api('android', FAKE_PROJECT_DIR, new EventEmitter());
|
||||
|
||||
@@ -17,12 +17,12 @@
|
||||
under the License.
|
||||
*/
|
||||
|
||||
var rewire = require('rewire');
|
||||
var android_sdk = require('../../lib/android_sdk');
|
||||
var fs = require('fs-extra');
|
||||
var path = require('path');
|
||||
var events = require('cordova-common').events;
|
||||
var which = require('which');
|
||||
const rewire = require('rewire');
|
||||
const android_sdk = require('../../lib/android_sdk');
|
||||
const fs = require('fs-extra');
|
||||
const path = require('path');
|
||||
const events = require('cordova-common').events;
|
||||
const which = require('which');
|
||||
|
||||
const {
|
||||
SDK_VERSION: DEFAULT_TARGET_API
|
||||
@@ -34,7 +34,7 @@ describe('check_reqs', function () {
|
||||
check_reqs = rewire('../../lib/check_reqs');
|
||||
});
|
||||
|
||||
var original_env;
|
||||
let original_env;
|
||||
beforeAll(function () {
|
||||
original_env = Object.assign({}, process.env);
|
||||
});
|
||||
@@ -263,8 +263,8 @@ describe('check_reqs', function () {
|
||||
|
||||
describe('get_target', function () {
|
||||
const projectRoot = 'fakeProjectRoot';
|
||||
var ConfigParser;
|
||||
var getPreferenceSpy;
|
||||
let ConfigParser;
|
||||
let getPreferenceSpy;
|
||||
beforeEach(function () {
|
||||
getPreferenceSpy = jasmine.createSpy();
|
||||
ConfigParser = jasmine.createSpy().and.returnValue({
|
||||
@@ -274,7 +274,7 @@ describe('check_reqs', function () {
|
||||
});
|
||||
|
||||
it('should retrieve DEFAULT_TARGET_API', function () {
|
||||
var target = check_reqs.get_target(projectRoot);
|
||||
const target = check_reqs.get_target(projectRoot);
|
||||
expect(target).toBeDefined();
|
||||
expect(target).toContain('android-' + DEFAULT_TARGET_API);
|
||||
});
|
||||
@@ -283,7 +283,7 @@ describe('check_reqs', function () {
|
||||
spyOn(fs, 'existsSync').and.returnValue(true);
|
||||
getPreferenceSpy.and.returnValue(String(DEFAULT_TARGET_API + 1));
|
||||
|
||||
var target = check_reqs.get_target(projectRoot);
|
||||
const target = check_reqs.get_target(projectRoot);
|
||||
|
||||
expect(getPreferenceSpy).toHaveBeenCalledWith('android-targetSdkVersion', 'android');
|
||||
expect(target).toBe('android-' + (DEFAULT_TARGET_API + 1));
|
||||
@@ -293,7 +293,7 @@ describe('check_reqs', function () {
|
||||
spyOn(fs, 'existsSync').and.returnValue(true);
|
||||
getPreferenceSpy.and.returnValue('android-99');
|
||||
|
||||
var target = check_reqs.get_target(projectRoot);
|
||||
const target = check_reqs.get_target(projectRoot);
|
||||
|
||||
expect(getPreferenceSpy).toHaveBeenCalledWith('android-targetSdkVersion', 'android');
|
||||
expect(target).toBe('android-' + DEFAULT_TARGET_API);
|
||||
@@ -306,7 +306,7 @@ describe('check_reqs', function () {
|
||||
|
||||
getPreferenceSpy.and.returnValue(String(DEFAULT_TARGET_API - 1));
|
||||
|
||||
var target = check_reqs.get_target(projectRoot);
|
||||
const target = check_reqs.get_target(projectRoot);
|
||||
|
||||
expect(getPreferenceSpy).toHaveBeenCalledWith('android-targetSdkVersion', 'android');
|
||||
expect(target).toBe('android-' + DEFAULT_TARGET_API);
|
||||
@@ -316,7 +316,7 @@ describe('check_reqs', function () {
|
||||
|
||||
describe('check_android_target', function () {
|
||||
it('should should return full list of supported targets if there is a match to ideal api level', () => {
|
||||
var fake_targets = ['you are my fire', 'my one desire'];
|
||||
const fake_targets = ['you are my fire', 'my one desire'];
|
||||
spyOn(android_sdk, 'list_targets').and.resolveTo(fake_targets);
|
||||
spyOn(check_reqs, 'get_target').and.returnValue('you are my fire');
|
||||
return check_reqs.check_android_target().then(function (targets) {
|
||||
@@ -325,7 +325,7 @@ describe('check_reqs', function () {
|
||||
});
|
||||
});
|
||||
it('should error out if there is no match between ideal api level and installed targets', () => {
|
||||
var fake_targets = ['you are my fire', 'my one desire'];
|
||||
const fake_targets = ['you are my fire', 'my one desire'];
|
||||
spyOn(android_sdk, 'list_targets').and.resolveTo(fake_targets);
|
||||
spyOn(check_reqs, 'get_target').and.returnValue('and i knowwwwwwwwwwww');
|
||||
return check_reqs.check_android_target().then(() => {
|
||||
|
||||
+17
-17
@@ -17,17 +17,17 @@
|
||||
under the License.
|
||||
*/
|
||||
|
||||
var rewire = require('rewire');
|
||||
var utils = require('../../lib/utils');
|
||||
var create = rewire('../../lib/create');
|
||||
var check_reqs = require('../../lib/check_reqs');
|
||||
var fs = require('fs-extra');
|
||||
var path = require('path');
|
||||
const rewire = require('rewire');
|
||||
const utils = require('../../lib/utils');
|
||||
const create = rewire('../../lib/create');
|
||||
const check_reqs = require('../../lib/check_reqs');
|
||||
const fs = require('fs-extra');
|
||||
const path = require('path');
|
||||
|
||||
describe('create', function () {
|
||||
describe('validatePackageName helper method', function () {
|
||||
describe('happy path (valid package names)', function () {
|
||||
var valid = [
|
||||
const valid = [
|
||||
'org.apache.mobilespec',
|
||||
'com.example',
|
||||
'com.floors42.package',
|
||||
@@ -82,7 +82,7 @@ describe('create', function () {
|
||||
|
||||
describe('validateProjectName helper method', function () {
|
||||
describe('happy path (valid project names)', function () {
|
||||
var valid = [
|
||||
const valid = [
|
||||
'mobilespec',
|
||||
'package_name',
|
||||
'PackageName',
|
||||
@@ -111,14 +111,14 @@ describe('create', function () {
|
||||
});
|
||||
|
||||
describe('main method', function () {
|
||||
var config_mock;
|
||||
var events_mock;
|
||||
var Manifest_mock = function () {};
|
||||
var revert_manifest_mock;
|
||||
var project_path = path.join('some', 'path');
|
||||
var app_path = path.join(project_path, 'app', 'src', 'main');
|
||||
var default_templates = path.join(__dirname, '..', '..', 'templates', 'project');
|
||||
var fake_android_target = 'android-1337';
|
||||
let config_mock;
|
||||
let events_mock;
|
||||
const Manifest_mock = function () {};
|
||||
let revert_manifest_mock;
|
||||
const project_path = path.join('some', 'path');
|
||||
const app_path = path.join(project_path, 'app', 'src', 'main');
|
||||
const default_templates = path.join(__dirname, '..', '..', 'templates', 'project');
|
||||
const fake_android_target = 'android-1337';
|
||||
|
||||
beforeEach(function () {
|
||||
Manifest_mock.prototype = jasmine.createSpyObj('AndroidManifest instance mock', ['setPackageId', 'getActivity', 'setName', 'write']);
|
||||
@@ -260,7 +260,7 @@ describe('create', function () {
|
||||
it('should copy, rename and interpolate the template Activity java class with the project-specific activity name and package name', () => {
|
||||
config_mock.packageName.and.returnValue('org.apache.cordova');
|
||||
config_mock.android_activityName.and.returnValue('CEEDEEVEE');
|
||||
var activity_path = path.join(app_path, 'java', 'org', 'apache', 'cordova', 'CEEDEEVEE.java');
|
||||
const activity_path = path.join(app_path, 'java', 'org', 'apache', 'cordova', 'CEEDEEVEE.java');
|
||||
return create.create(project_path, config_mock, {}, events_mock).then(() => {
|
||||
expect(fs.copySync).toHaveBeenCalledWith(path.join(default_templates, 'Activity.java'), activity_path);
|
||||
expect(utils.replaceFileContents).toHaveBeenCalledWith(activity_path, /__ACTIVITY__/, 'CEEDEEVEE');
|
||||
|
||||
@@ -16,24 +16,24 @@
|
||||
*
|
||||
*/
|
||||
|
||||
var rewire = require('rewire');
|
||||
var common = rewire('../../../lib/pluginHandlers');
|
||||
var path = require('path');
|
||||
var fs = require('fs-extra');
|
||||
var osenv = require('os');
|
||||
const rewire = require('rewire');
|
||||
const common = rewire('../../../lib/pluginHandlers');
|
||||
const path = require('path');
|
||||
const fs = require('fs-extra');
|
||||
const osenv = require('os');
|
||||
|
||||
var test_dir = path.join(osenv.tmpdir(), 'test_plugman');
|
||||
var project_dir = path.join(test_dir, 'project');
|
||||
var src = path.join(project_dir, 'src');
|
||||
var dest = path.join(project_dir, 'dest');
|
||||
var java_dir = path.join(src, 'one', 'two', 'three');
|
||||
var java_file = path.join(java_dir, 'test.java');
|
||||
var symlink_file = path.join(java_dir, 'symlink');
|
||||
var non_plugin_file = path.join(osenv.tmpdir(), 'non_plugin_file');
|
||||
const test_dir = path.join(osenv.tmpdir(), 'test_plugman');
|
||||
const project_dir = path.join(test_dir, 'project');
|
||||
const src = path.join(project_dir, 'src');
|
||||
const dest = path.join(project_dir, 'dest');
|
||||
const java_dir = path.join(src, 'one', 'two', 'three');
|
||||
const java_file = path.join(java_dir, 'test.java');
|
||||
const symlink_file = path.join(java_dir, 'symlink');
|
||||
const non_plugin_file = path.join(osenv.tmpdir(), 'non_plugin_file');
|
||||
|
||||
var copyFile = common.__get__('copyFile');
|
||||
var deleteJava = common.__get__('deleteJava');
|
||||
var copyNewFile = common.__get__('copyNewFile');
|
||||
const copyFile = common.__get__('copyFile');
|
||||
const deleteJava = common.__get__('deleteJava');
|
||||
const copyNewFile = common.__get__('copyNewFile');
|
||||
|
||||
describe('common platform handler', function () {
|
||||
afterEach(() => {
|
||||
@@ -50,7 +50,7 @@ describe('common platform handler', function () {
|
||||
it('Test#002 : should throw if src not in plugin directory', function () {
|
||||
fs.ensureDirSync(project_dir);
|
||||
fs.outputFileSync(non_plugin_file, 'contents');
|
||||
var outside_file = '../non_plugin_file';
|
||||
const outside_file = '../non_plugin_file';
|
||||
expect(function () { copyFile(test_dir, outside_file, project_dir, dest); })
|
||||
.toThrow(new Error('File "' + path.resolve(test_dir, outside_file) + '" is located outside the plugin directory "' + test_dir + '"'));
|
||||
});
|
||||
@@ -88,8 +88,8 @@ describe('common platform handler', function () {
|
||||
it('Test#006 : should call mkdir -p on target path', function () {
|
||||
fs.outputFileSync(java_file, 'contents');
|
||||
|
||||
var s = spyOn(fs, 'ensureDirSync').and.callThrough();
|
||||
var resolvedDest = path.resolve(project_dir, dest);
|
||||
const s = spyOn(fs, 'ensureDirSync').and.callThrough();
|
||||
const resolvedDest = path.resolve(project_dir, dest);
|
||||
|
||||
copyFile(test_dir, java_file, project_dir, dest);
|
||||
|
||||
@@ -100,8 +100,8 @@ describe('common platform handler', function () {
|
||||
it('Test#007 : should call cp source/dest paths', function () {
|
||||
fs.outputFileSync(java_file, 'contents');
|
||||
|
||||
var s = spyOn(fs, 'copySync').and.callThrough();
|
||||
var resolvedDest = path.resolve(project_dir, dest);
|
||||
const s = spyOn(fs, 'copySync').and.callThrough();
|
||||
const resolvedDest = path.resolve(project_dir, dest);
|
||||
|
||||
copyFile(test_dir, java_file, project_dir, dest);
|
||||
|
||||
@@ -133,7 +133,7 @@ describe('common platform handler', function () {
|
||||
});
|
||||
|
||||
it('Test#009 : should call fs.unlinkSync on the provided paths', function () {
|
||||
var s = spyOn(fs, 'removeSync').and.callThrough();
|
||||
const s = spyOn(fs, 'removeSync').and.callThrough();
|
||||
deleteJava(project_dir, java_file);
|
||||
expect(s).toHaveBeenCalled();
|
||||
expect(s).toHaveBeenCalledWith(path.resolve(project_dir, java_file));
|
||||
|
||||
@@ -17,34 +17,34 @@
|
||||
under the License.
|
||||
*/
|
||||
|
||||
var rewire = require('rewire');
|
||||
var common = rewire('../../../lib/pluginHandlers');
|
||||
var android = common.__get__('handlers');
|
||||
var path = require('path');
|
||||
var fs = require('fs-extra');
|
||||
var os = require('os');
|
||||
var temp = path.join(os.tmpdir(), 'plugman');
|
||||
var plugins_dir = path.join(temp, 'cordova/plugins');
|
||||
var dummyplugin = path.join(__dirname, '../../fixtures/org.test.plugins.dummyplugin');
|
||||
var faultyplugin = path.join(__dirname, '../../fixtures/org.test.plugins.faultyplugin');
|
||||
var android_studio_project = path.join(__dirname, '../../fixtures/android_studio_project');
|
||||
const rewire = require('rewire');
|
||||
const common = rewire('../../../lib/pluginHandlers');
|
||||
const android = common.__get__('handlers');
|
||||
const path = require('path');
|
||||
const fs = require('fs-extra');
|
||||
const os = require('os');
|
||||
const temp = path.join(os.tmpdir(), 'plugman');
|
||||
const plugins_dir = path.join(temp, 'cordova/plugins');
|
||||
const dummyplugin = path.join(__dirname, '../../fixtures/org.test.plugins.dummyplugin');
|
||||
const faultyplugin = path.join(__dirname, '../../fixtures/org.test.plugins.faultyplugin');
|
||||
const android_studio_project = path.join(__dirname, '../../fixtures/android_studio_project');
|
||||
|
||||
var PluginInfo = require('cordova-common').PluginInfo;
|
||||
var AndroidProject = require('../../../lib/AndroidProject');
|
||||
const PluginInfo = require('cordova-common').PluginInfo;
|
||||
const AndroidProject = require('../../../lib/AndroidProject');
|
||||
|
||||
var dummyPluginInfo = new PluginInfo(dummyplugin);
|
||||
var valid_source = dummyPluginInfo.getSourceFiles('android');
|
||||
var valid_resources = dummyPluginInfo.getResourceFiles('android');
|
||||
var valid_libs = dummyPluginInfo.getLibFiles('android');
|
||||
const dummyPluginInfo = new PluginInfo(dummyplugin);
|
||||
const valid_source = dummyPluginInfo.getSourceFiles('android');
|
||||
const valid_resources = dummyPluginInfo.getResourceFiles('android');
|
||||
const valid_libs = dummyPluginInfo.getLibFiles('android');
|
||||
|
||||
var faultyPluginInfo = new PluginInfo(faultyplugin);
|
||||
var invalid_source = faultyPluginInfo.getSourceFiles('android');
|
||||
const faultyPluginInfo = new PluginInfo(faultyplugin);
|
||||
const invalid_source = faultyPluginInfo.getSourceFiles('android');
|
||||
|
||||
describe('android project handler', function () {
|
||||
describe('installation', function () {
|
||||
var copyFileOrig = common.__get__('copyFile');
|
||||
var copyFileSpy = jasmine.createSpy('copyFile');
|
||||
var dummyProject;
|
||||
const copyFileOrig = common.__get__('copyFile');
|
||||
const copyFileSpy = jasmine.createSpy('copyFile');
|
||||
let dummyProject;
|
||||
|
||||
beforeEach(function () {
|
||||
fs.ensureDirSync(temp);
|
||||
@@ -177,10 +177,10 @@ describe('android project handler', function () {
|
||||
});
|
||||
|
||||
describe('of <framework> elements', function () {
|
||||
var someString = jasmine.any(String);
|
||||
const someString = jasmine.any(String);
|
||||
|
||||
var copyNewFileOrig = common.__get__('copyNewFile');
|
||||
var copyNewFileSpy = jasmine.createSpy('copyNewFile');
|
||||
const copyNewFileOrig = common.__get__('copyNewFile');
|
||||
const copyNewFileSpy = jasmine.createSpy('copyNewFile');
|
||||
|
||||
beforeEach(function () {
|
||||
fs.copySync(android_studio_project, temp);
|
||||
@@ -200,34 +200,34 @@ describe('android project handler', function () {
|
||||
});
|
||||
|
||||
it('Test#008 : should install framework without "parent" attribute into project root', function () {
|
||||
var framework = { src: 'plugin-lib' };
|
||||
const framework = { src: 'plugin-lib' };
|
||||
android.framework.install(framework, dummyPluginInfo, dummyProject);
|
||||
expect(dummyProject.addSystemLibrary).toHaveBeenCalledWith(dummyProject.projectDir, someString);
|
||||
});
|
||||
|
||||
it('Test#009 : should install framework with "parent" attribute into parent framework dir', function () {
|
||||
var childFramework = { src: 'plugin-lib2', parent: 'plugin-lib' };
|
||||
const childFramework = { src: 'plugin-lib2', parent: 'plugin-lib' };
|
||||
android.framework.install(childFramework, dummyPluginInfo, dummyProject);
|
||||
expect(dummyProject.addSystemLibrary).toHaveBeenCalledWith(path.resolve(dummyProject.projectDir, childFramework.parent), someString);
|
||||
});
|
||||
|
||||
it('Test#010 : should not copy anything if "custom" attribute is not set', function () {
|
||||
var framework = { src: 'plugin-lib' };
|
||||
var cpSpy = spyOn(fs, 'copySync');
|
||||
const framework = { src: 'plugin-lib' };
|
||||
const cpSpy = spyOn(fs, 'copySync');
|
||||
android.framework.install(framework, dummyPluginInfo, dummyProject);
|
||||
expect(dummyProject.addSystemLibrary).toHaveBeenCalledWith(someString, framework.src);
|
||||
expect(cpSpy).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('Test#011 : should copy framework sources if "custom" attribute is set', function () {
|
||||
var framework = { src: 'plugin-lib', custom: true };
|
||||
const framework = { src: 'plugin-lib', custom: true };
|
||||
android.framework.install(framework, dummyPluginInfo, dummyProject);
|
||||
expect(dummyProject.addSubProject).toHaveBeenCalledWith(dummyProject.projectDir, someString);
|
||||
expect(copyNewFileSpy).toHaveBeenCalledWith(dummyPluginInfo.dir, framework.src, dummyProject.projectDir, someString, false);
|
||||
});
|
||||
|
||||
it('Test#012 : should install gradleReference using project.addGradleReference', function () {
|
||||
var framework = { src: 'plugin-lib', custom: true, type: 'gradleReference' };
|
||||
const framework = { src: 'plugin-lib', custom: true, type: 'gradleReference' };
|
||||
android.framework.install(framework, dummyPluginInfo, dummyProject);
|
||||
expect(copyNewFileSpy).toHaveBeenCalledWith(dummyPluginInfo.dir, framework.src, dummyProject.projectDir, someString, false);
|
||||
expect(dummyProject.addGradleReference).toHaveBeenCalledWith(dummyProject.projectDir, someString);
|
||||
@@ -235,8 +235,8 @@ describe('android project handler', function () {
|
||||
});
|
||||
|
||||
describe('of <js-module> elements', function () {
|
||||
var jsModule = { src: 'www/dummyplugin.js' };
|
||||
var wwwDest, platformWwwDest;
|
||||
const jsModule = { src: 'www/dummyplugin.js' };
|
||||
let wwwDest, platformWwwDest;
|
||||
|
||||
beforeEach(function () {
|
||||
spyOn(fs, 'writeFileSync');
|
||||
@@ -258,7 +258,7 @@ describe('android project handler', function () {
|
||||
});
|
||||
|
||||
describe('of <asset> elements', function () {
|
||||
var asset;
|
||||
let asset;
|
||||
|
||||
beforeEach(function () {
|
||||
asset = { src: 'www/dummyPlugin.js', target: 'foo/dummy.js' };
|
||||
@@ -279,10 +279,10 @@ describe('android project handler', function () {
|
||||
});
|
||||
|
||||
describe('uninstallation', function () {
|
||||
var deleteJavaOrig = common.__get__('deleteJava');
|
||||
const deleteJavaOrig = common.__get__('deleteJava');
|
||||
const originalRemoveSync = fs.removeSync;
|
||||
var deleteJavaSpy = jasmine.createSpy('deleteJava');
|
||||
var dummyProject;
|
||||
const deleteJavaSpy = jasmine.createSpy('deleteJava');
|
||||
let dummyProject;
|
||||
let removeSyncSpy;
|
||||
|
||||
beforeEach(function () {
|
||||
@@ -385,7 +385,7 @@ describe('android project handler', function () {
|
||||
});
|
||||
|
||||
describe('of <framework> elements', function () {
|
||||
var someString = jasmine.any(String);
|
||||
const someString = jasmine.any(String);
|
||||
|
||||
beforeEach(function () {
|
||||
fs.ensureDirSync(path.join(dummyProject.projectDir, dummyPluginInfo.id));
|
||||
@@ -400,26 +400,26 @@ describe('android project handler', function () {
|
||||
});
|
||||
|
||||
it('Test#021 : should uninstall framework without "parent" attribute into project root', function () {
|
||||
var framework = { src: 'plugin-lib' };
|
||||
const framework = { src: 'plugin-lib' };
|
||||
android.framework.uninstall(framework, dummyPluginInfo, dummyProject);
|
||||
expect(dummyProject.removeSystemLibrary).toHaveBeenCalledWith(dummyProject.projectDir, someString);
|
||||
});
|
||||
|
||||
it('Test#022 : should uninstall framework with "parent" attribute into parent framework dir', function () {
|
||||
var childFramework = { src: 'plugin-lib2', parent: 'plugin-lib' };
|
||||
const childFramework = { src: 'plugin-lib2', parent: 'plugin-lib' };
|
||||
android.framework.uninstall(childFramework, dummyPluginInfo, dummyProject);
|
||||
expect(dummyProject.removeSystemLibrary).toHaveBeenCalledWith(path.resolve(dummyProject.projectDir, childFramework.parent), someString);
|
||||
});
|
||||
|
||||
it('Test#023 : should remove framework sources if "custom" attribute is set', function () {
|
||||
var framework = { src: 'plugin-lib', custom: true };
|
||||
const framework = { src: 'plugin-lib', custom: true };
|
||||
android.framework.uninstall(framework, dummyPluginInfo, dummyProject);
|
||||
expect(dummyProject.removeSubProject).toHaveBeenCalledWith(dummyProject.projectDir, someString);
|
||||
expect(removeSyncSpy).toHaveBeenCalledWith(someString);
|
||||
});
|
||||
|
||||
it('Test#24 : should install gradleReference using project.removeGradleReference', function () {
|
||||
var framework = { src: 'plugin-lib', custom: true, type: 'gradleReference' };
|
||||
const framework = { src: 'plugin-lib', custom: true, type: 'gradleReference' };
|
||||
android.framework.uninstall(framework, dummyPluginInfo, dummyProject);
|
||||
expect(removeSyncSpy).toHaveBeenCalledWith(someString);
|
||||
expect(dummyProject.removeGradleReference).toHaveBeenCalledWith(dummyProject.projectDir, someString);
|
||||
@@ -427,15 +427,15 @@ describe('android project handler', function () {
|
||||
});
|
||||
|
||||
describe('of <js-module> elements', function () {
|
||||
var jsModule = { src: 'www/dummyPlugin.js' };
|
||||
var wwwDest;
|
||||
var platformWwwDest;
|
||||
const jsModule = { src: 'www/dummyPlugin.js' };
|
||||
let wwwDest;
|
||||
let platformWwwDest;
|
||||
|
||||
beforeEach(function () {
|
||||
wwwDest = path.resolve(dummyProject.www, 'plugins', dummyPluginInfo.id, jsModule.src);
|
||||
platformWwwDest = path.resolve(dummyProject.platformWww, 'plugins', dummyPluginInfo.id, jsModule.src);
|
||||
|
||||
var existsSyncOrig = fs.existsSync;
|
||||
const existsSyncOrig = fs.existsSync;
|
||||
spyOn(fs, 'existsSync').and.callFake(function (file) {
|
||||
if ([wwwDest, platformWwwDest].indexOf(file) >= 0) return true;
|
||||
return existsSyncOrig.call(fs, file);
|
||||
@@ -456,14 +456,14 @@ describe('android project handler', function () {
|
||||
});
|
||||
|
||||
describe('of <asset> elements', function () {
|
||||
var asset = { src: 'www/dummyPlugin.js', target: 'foo/dummy.js' };
|
||||
var wwwDest, platformWwwDest;
|
||||
const asset = { src: 'www/dummyPlugin.js', target: 'foo/dummy.js' };
|
||||
let wwwDest, platformWwwDest;
|
||||
|
||||
beforeEach(function () {
|
||||
wwwDest = path.resolve(dummyProject.www, asset.target);
|
||||
platformWwwDest = path.resolve(dummyProject.platformWww, asset.target);
|
||||
|
||||
var existsSyncOrig = fs.existsSync;
|
||||
const existsSyncOrig = fs.existsSync;
|
||||
spyOn(fs, 'existsSync').and.callFake(function (file) {
|
||||
if ([wwwDest, platformWwwDest].indexOf(file) >= 0) return true;
|
||||
return existsSyncOrig.call(fs, file);
|
||||
|
||||
@@ -17,9 +17,9 @@
|
||||
under the License.
|
||||
*/
|
||||
|
||||
var rewire = require('rewire');
|
||||
var path = require('path');
|
||||
var CordovaError = require('cordova-common').CordovaError;
|
||||
const rewire = require('rewire');
|
||||
const path = require('path');
|
||||
const CordovaError = require('cordova-common').CordovaError;
|
||||
const GradlePropertiesParser = require('../../lib/config/GradlePropertiesParser');
|
||||
|
||||
const PATH_RESOURCE = path.join('platforms', 'android', 'app', 'src', 'main', 'res');
|
||||
@@ -688,7 +688,7 @@ describe('prepare', () => {
|
||||
};
|
||||
const platformResourcesDir = PATH_RESOURCE;
|
||||
|
||||
var expectedResourceMapBackground = createResourceMap('ic_launcher_background.png');
|
||||
const expectedResourceMapBackground = createResourceMap('ic_launcher_background.png');
|
||||
|
||||
// mocking initial responses for mapImageResources
|
||||
prepare.__set__('mapImageResources', function (rootDir, subDir, type, resourceName) {
|
||||
@@ -719,7 +719,7 @@ describe('prepare', () => {
|
||||
};
|
||||
const platformResourcesDir = PATH_RESOURCE;
|
||||
|
||||
var expectedResourceMap = createResourceMap();
|
||||
const expectedResourceMap = createResourceMap();
|
||||
|
||||
// mocking initial responses for mapImageResources
|
||||
prepare.__set__('mapImageResources', function (rootDir, subDir, type, resourceName) {
|
||||
|
||||
Reference in New Issue
Block a user