You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by au...@apache.org on 2017/07/14 23:45:20 UTC
[3/5] ios commit: CB-12895 : removed jshint and added eslint
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/83435d56/tests/spec/unit/Api.spec.js
----------------------------------------------------------------------
diff --git a/tests/spec/unit/Api.spec.js b/tests/spec/unit/Api.spec.js
index a08b32e..14e178e 100644
--- a/tests/spec/unit/Api.spec.js
+++ b/tests/spec/unit/Api.spec.js
@@ -43,13 +43,13 @@ var iosProjectFixture = path.join(FIXTURES, 'ios-config-xml');
describe('Platform Api', function () {
- describe('constructor', function() {
- it('Test 001 : should throw if provided directory does not contain an xcodeproj file', function() {
- expect(function() { new Api('ios', path.join(FIXTURES, '..')); }).toThrow();
+ describe('constructor', function () {
+ it('Test 001 : should throw if provided directory does not contain an xcodeproj file', function () {
+ expect(function () { new Api('ios', path.join(FIXTURES, '..')); }).toThrow(); /* eslint no-new : 0 */
});
- it('Test 002 : should create an instance with path, pbxproj, xcodeproj, originalName and cordovaproj properties', function() {
- expect(function() {
- var p = new Api('ios',iosProjectFixture);
+ it('Test 002 : should create an instance with path, pbxproj, xcodeproj, originalName and cordovaproj properties', function () {
+ expect(function () {
+ var p = new Api('ios', iosProjectFixture);
expect(p.locations.root).toEqual(iosProjectFixture);
expect(p.locations.pbxproj).toEqual(path.join(iosProjectFixture, 'SampleApp.xcodeproj', 'project.pbxproj'));
expect(p.locations.xcodeProjDir).toEqual(path.join(iosProjectFixture, 'SampleApp.xcodeproj'));
@@ -57,70 +57,70 @@ describe('Platform Api', function () {
expect(p.locations.configXml).toEqual(path.join(iosProjectFixture, 'SampleApp', 'config.xml'));
}).not.toThrow();
});
- it('Test 003 : test cocoapods check_reqs, on darwin (macOS)', function(done) {
+ it('Test 003 : test cocoapods check_reqs, on darwin (macOS)', function (done) {
// the purpose of this test is not to actually test whether CocoaPods is installed
// it is to test check_reqs can run and be covered (we mock the actual checking, simple check)
check_reqs.check_os()
- .then(function(message) {
- // supported os
- function fail() {
- done.fail('check_reqs fail (' + message + ')');
- }
- function success() {
- done();
- }
- var toolsChecker = {
- success: function() {
- return Q.resolve('CocoaPods found');
- },
- fail: function() {
- return Q.reject('CocoaPods NOT found');
+ .then(function (message) {
+ // supported os
+ function fail () {
+ done.fail('check_reqs fail (' + message + ')');
}
- };
+ function success () {
+ done();
+ }
+ var toolsChecker = {
+ success: function () {
+ return Q.resolve('CocoaPods found');
+ },
+ fail: function () {
+ return Q.reject('CocoaPods NOT found');
+ }
+ };
- // success expected
- check_reqs.check_cocoapods(toolsChecker.success)
- .then(success, fail)
- .catch(fail);
+ // success expected
+ check_reqs.check_cocoapods(toolsChecker.success)
+ .then(success, fail)
+ .catch(fail);
- // fail expected
- check_reqs.check_cocoapods(toolsChecker.fail)
- .then(fail, success)
- .catch(success);
-
- }, function(){
- // unsupported os, do nothing
- done();
- });
+ // fail expected
+ check_reqs.check_cocoapods(toolsChecker.fail)
+ .then(fail, success)
+ .catch(success);
+
+ }, function () {
+ // unsupported os, do nothing
+ done();
+ });
});
- it('Test 004 : test cocoapods check_reqs, expected success on non-darwin (macOS)', function(done) {
+ it('Test 004 : test cocoapods check_reqs, expected success on non-darwin (macOS)', function (done) {
// the purpose of this test is not to actually test whether CocoaPods is installed
// it is to test check_reqs can run and be covered (we mock the actual checking, simple check)
check_reqs.check_os()
- .then(function(){
- // supported os, do nothing
- done();
- }, function(message) {
- // unsupported os, check_reqs should be ignored
- function fail() {
- done.fail('check_reqs fail (' + message + ')');
- }
- function success(toolOptions) {
- expect(toolOptions.ignore).toBeDefined();
- expect(toolOptions.ignoreMessage).toBeDefined();
+ .then(function () {
+ // supported os, do nothing
done();
- }
- var toolsChecker = function () {
- done.fail(); // this function should not ever be called if non-darwin
- return Q.reject('CocoaPods NOT found');
- };
+ }, function (message) {
+ // unsupported os, check_reqs should be ignored
+ function fail () {
+ done.fail('check_reqs fail (' + message + ')');
+ }
+ function success (toolOptions) {
+ expect(toolOptions.ignore).toBeDefined();
+ expect(toolOptions.ignoreMessage).toBeDefined();
+ done();
+ }
+ var toolsChecker = function () {
+ done.fail(); // this function should not ever be called if non-darwin
+ return Q.reject('CocoaPods NOT found');
+ };
- // success expected
- check_reqs.check_cocoapods(toolsChecker)
- .then(success, fail)
- .catch(fail);
- });
+ // success expected
+ check_reqs.check_cocoapods(toolsChecker)
+ .then(success, fail)
+ .catch(fail);
+ });
});
});
@@ -198,45 +198,45 @@ describe('Platform Api', function () {
});
spyOn(events, 'emit');
api.addPlugin(my_plugin)
- .then(function () {
- expect(events.emit).toHaveBeenCalledWith('warn', jasmine.stringMatching(/which conflicts with another plugin/g));
- }).fail(function (err) {
- fail('unexpected addPlugin fail handler invoked');
- console.error(err);
- }).done(done);
+ .then(function () {
+ expect(events.emit).toHaveBeenCalledWith('warn', jasmine.stringMatching(/which conflicts with another plugin/g));
+ }).fail(function (err) {
+ fail('unexpected addPlugin fail handler invoked');
+ console.error(err);
+ }).done(done);
});
it('should increment Pods JSON file if pod name/src already exists in file', function (done) {
podsjson_mock.get.and.returnValue({
spec: my_pod_json.spec
});
api.addPlugin(my_plugin)
- .then(function () {
- expect(podsjson_mock.increment).toHaveBeenCalledWith('podsource!');
- }).fail(function (err) {
- fail('unexpected addPlugin fail handler invoked');
- console.error(err);
- }).done(done);
+ .then(function () {
+ expect(podsjson_mock.increment).toHaveBeenCalledWith('podsource!');
+ }).fail(function (err) {
+ fail('unexpected addPlugin fail handler invoked');
+ console.error(err);
+ }).done(done);
});
it('on a new framework/pod name/src/key, it should add a new json to podsjson and add a new spec to podfile', function (done) {
api.addPlugin(my_plugin)
- .then(function () {
- expect(podsjson_mock.setJson).toHaveBeenCalledWith(my_pod_json.src, jasmine.any(Object));
- expect(podfile_mock.addSpec).toHaveBeenCalledWith(my_pod_json.src, my_pod_json.spec);
- }).fail(function (err) {
- fail('unexpected addPlugin fail handler invoked');
- console.error(err);
- }).done(done);
+ .then(function () {
+ expect(podsjson_mock.setJson).toHaveBeenCalledWith(my_pod_json.src, jasmine.any(Object));
+ expect(podfile_mock.addSpec).toHaveBeenCalledWith(my_pod_json.src, my_pod_json.spec);
+ }).fail(function (err) {
+ fail('unexpected addPlugin fail handler invoked');
+ console.error(err);
+ }).done(done);
});
it('should write out podfile and install if podfile was changed', function (done) {
podfile_mock.isDirty.and.returnValue(true);
api.addPlugin(my_plugin)
- .then(function () {
- expect(podfile_mock.write).toHaveBeenCalled();
- expect(podfile_mock.install).toHaveBeenCalled();
- }).fail(function (err) {
- fail('unexpected addPlugin fail handler invoked');
- console.error(err);
- }).done(done);
+ .then(function () {
+ expect(podfile_mock.write).toHaveBeenCalled();
+ expect(podfile_mock.install).toHaveBeenCalled();
+ }).fail(function (err) {
+ fail('unexpected addPlugin fail handler invoked');
+ console.error(err);
+ }).done(done);
});
it('if two frameworks with the same name are added, should honour the spec of the first-installed plugin', function (done) {
spyOn(events, 'emit');
@@ -244,15 +244,15 @@ describe('Platform Api', function () {
spec: 'something different from ' + my_pod_json.spec
});
api.addPlugin(my_plugin)
- .then(function () {
- // Increment will non-destructively set the spec to keep it as it was...
- expect(podsjson_mock.increment).toHaveBeenCalledWith(my_pod_json.src);
- // ...whereas setJson would overwrite it completely.
- expect(podsjson_mock.setJson).not.toHaveBeenCalled();
- }).fail(function (err) {
- fail('unexpected addPlugin fail handler invoked');
- console.error(err);
- }).done(done);
+ .then(function () {
+ // Increment will non-destructively set the spec to keep it as it was...
+ expect(podsjson_mock.increment).toHaveBeenCalledWith(my_pod_json.src);
+ // ...whereas setJson would overwrite it completely.
+ expect(podsjson_mock.setJson).not.toHaveBeenCalled();
+ }).fail(function (err) {
+ fail('unexpected addPlugin fail handler invoked');
+ console.error(err);
+ }).done(done);
});
});
});
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/83435d56/tests/spec/unit/Plugman/common.spec.js
----------------------------------------------------------------------
diff --git a/tests/spec/unit/Plugman/common.spec.js b/tests/spec/unit/Plugman/common.spec.js
index 7a0c344..5608c51 100644
--- a/tests/spec/unit/Plugman/common.spec.js
+++ b/tests/spec/unit/Plugman/common.spec.js
@@ -37,25 +37,25 @@ var copyFile = common.__get__('copyFile');
var copyNewFile = common.__get__('copyNewFile');
var removeFileAndParents = common.__get__('removeFileAndParents');
-describe('common handler routines', function() {
+describe('common handler routines', function () {
- describe('copyFile', function() {
- it('Test 001 : should throw if source path not found', function(){
+ describe('copyFile', function () {
+ it('Test 001 : should throw if source path not found', function () {
shell.rm('-rf', test_dir);
- expect(function(){copyFile(test_dir, src, project_dir, dest);}).
- toThrow(new Error('"' + src + '" not found!'));
+ expect(function () { copyFile(test_dir, src, project_dir, dest); })
+ .toThrow(new Error('"' + src + '" not found!'));
});
- it('Test 002 : should throw if src not in plugin directory', function(){
+ it('Test 002 : should throw if src not in plugin directory', function () {
shell.mkdir('-p', project_dir);
fs.writeFileSync(non_plugin_file, 'contents', 'utf-8');
var 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 + '"'));
+ 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 + '"'));
shell.rm('-rf', test_dir);
});
- it('Test 003 : should allow symlink src, if inside plugin', function(){
+ it('Test 003 : should allow symlink src, if inside plugin', function () {
shell.mkdir('-p', srcDirTree);
fs.writeFileSync(srcFile, 'contents', 'utf-8');
@@ -68,7 +68,7 @@ describe('common handler routines', function() {
shell.rm('-rf', project_dir);
});
- it('Test 004 : should throw if symlink is linked to a file outside the plugin', function(){
+ it('Test 004 : should throw if symlink is linked to a file outside the plugin', function () {
shell.mkdir('-p', srcDirTree);
fs.writeFileSync(non_plugin_file, 'contents', 'utf-8');
@@ -77,20 +77,20 @@ describe('common handler routines', function() {
return;
}
- expect(function(){copyFile(test_dir, symlink_file, project_dir, dest);}).
- toThrow(new Error('File "' + path.resolve(test_dir, symlink_file) + '" is located outside the plugin directory "' + test_dir + '"'));
+ expect(function () { copyFile(test_dir, symlink_file, project_dir, dest); })
+ .toThrow(new Error('File "' + path.resolve(test_dir, symlink_file) + '" is located outside the plugin directory "' + test_dir + '"'));
shell.rm('-rf', project_dir);
});
- it('Test 005 : should throw if dest is outside the project directory', function(){
+ it('Test 005 : should throw if dest is outside the project directory', function () {
shell.mkdir('-p', srcDirTree);
fs.writeFileSync(srcFile, 'contents', 'utf-8');
- expect(function(){copyFile(test_dir, srcFile, project_dir, non_plugin_file);}).
- toThrow(new Error('Destination "' + path.resolve(project_dir, non_plugin_file) + '" for source file "' + path.resolve(test_dir, srcFile) + '" is located outside the project'));
+ expect(function () { copyFile(test_dir, srcFile, project_dir, non_plugin_file); })
+ .toThrow(new Error('Destination "' + path.resolve(project_dir, non_plugin_file) + '" for source file "' + path.resolve(test_dir, srcFile) + '" is located outside the project'));
shell.rm('-rf', project_dir);
});
- it('Test 006 : should call mkdir -p on target path', function(){
+ it('Test 006 : should call mkdir -p on target path', function () {
shell.mkdir('-p', srcDirTree);
fs.writeFileSync(srcFile, 'contents', 'utf-8');
@@ -104,7 +104,7 @@ describe('common handler routines', function() {
shell.rm('-rf', project_dir);
});
- it('Test 007 : should call cp source/dest paths', function(){
+ it('Test 007 : should call cp source/dest paths', function () {
shell.mkdir('-p', srcDirTree);
fs.writeFileSync(srcFile, 'contents', 'utf-8');
@@ -122,17 +122,17 @@ describe('common handler routines', function() {
});
describe('copyNewFile', function () {
- it('Test 008 : should throw if target path exists', function(){
+ it('Test 008 : should throw if target path exists', function () {
shell.mkdir('-p', dest);
- expect(function(){copyNewFile(test_dir, src, project_dir, dest);}).
- toThrow(new Error('"' + dest + '" already exists!'));
+ expect(function () { copyNewFile(test_dir, src, project_dir, dest); })
+ .toThrow(new Error('"' + dest + '" already exists!'));
shell.rm('-rf', dest);
});
});
- describe('deleteJava', function() {
- it('Test 009 : should call fs.unlinkSync on the provided paths', function(){
+ describe('deleteJava', function () {
+ it('Test 009 : should call fs.unlinkSync on the provided paths', function () {
shell.mkdir('-p', srcDirTree);
fs.writeFileSync(srcFile, 'contents', 'utf-8');
@@ -144,19 +144,19 @@ describe('common handler routines', function() {
shell.rm('-rf', srcDirTree);
});
- it('Test 010 : should delete empty directories after removing source code in path hierarchy', function(){
+ it('Test 010 : should delete empty directories after removing source code in path hierarchy', function () {
shell.mkdir('-p', srcDirTree);
fs.writeFileSync(srcFile, 'contents', 'utf-8');
removeFileAndParents(project_dir, srcFile);
expect(fs.existsSync(srcFile)).not.toBe(true);
expect(fs.existsSync(srcDirTree)).not.toBe(true);
- expect(fs.existsSync(path.join(src,'one'))).not.toBe(true);
+ expect(fs.existsSync(path.join(src, 'one'))).not.toBe(true);
shell.rm('-rf', srcDirTree);
});
- it('Test 011 : should delete the top-level src directory if all plugins added were removed', function(){
+ it('Test 011 : should delete the top-level src directory if all plugins added were removed', function () {
shell.mkdir('-p', srcDirTree);
fs.writeFileSync(srcFile, 'contents', 'utf-8');
@@ -168,7 +168,7 @@ describe('common handler routines', function() {
});
});
-function ignoreEPERMonWin32(symlink_src, symlink_dest) {
+function ignoreEPERMonWin32 (symlink_src, symlink_dest) {
try {
fs.symlinkSync(symlink_src, symlink_dest);
} catch (e) {
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/83435d56/tests/spec/unit/Plugman/pluginHandler.spec.js
----------------------------------------------------------------------
diff --git a/tests/spec/unit/Plugman/pluginHandler.spec.js b/tests/spec/unit/Plugman/pluginHandler.spec.js
index ee4fabe..00d2911 100644
--- a/tests/spec/unit/Plugman/pluginHandler.spec.js
+++ b/tests/spec/unit/Plugman/pluginHandler.spec.js
@@ -38,36 +38,35 @@ var weblessplugin = path.join(FIXTURES, 'org.test.plugins.weblessplugin');
var dummyPluginInfo = new PluginInfo(dummyplugin);
var dummy_id = dummyPluginInfo.id;
-var valid_source = dummyPluginInfo.getSourceFiles('ios'),
- valid_headers = dummyPluginInfo.getHeaderFiles('ios'),
- valid_resources = dummyPluginInfo.getResourceFiles('ios'),
- valid_custom_frameworks = dummyPluginInfo.getFrameworks('ios').filter(function(f) { return f.custom; }),
- valid_embeddable_custom_frameworks = dummyPluginInfo.getFrameworks('ios').filter(function(f) { return f.custom && f.embed; }),
- valid_weak_frameworks = dummyPluginInfo.getFrameworks('ios').filter(function(f) { return !(f.custom) && f.weak; });
-
+var valid_source = dummyPluginInfo.getSourceFiles('ios');
+var valid_headers = dummyPluginInfo.getHeaderFiles('ios');
+var valid_resources = dummyPluginInfo.getResourceFiles('ios');
+var valid_custom_frameworks = dummyPluginInfo.getFrameworks('ios').filter(function (f) { return f.custom; });
+var valid_embeddable_custom_frameworks = dummyPluginInfo.getFrameworks('ios').filter(function (f) { return f.custom && f.embed; });
+var valid_weak_frameworks = dummyPluginInfo.getFrameworks('ios').filter(function (f) { return !(f.custom) && f.weak; });
var faultyPluginInfo = new PluginInfo(faultyplugin);
var invalid_source = faultyPluginInfo.getSourceFiles('ios');
var invalid_headers = faultyPluginInfo.getHeaderFiles('ios');
var invalid_resources = faultyPluginInfo.getResourceFiles('ios');
-var invalid_custom_frameworks = faultyPluginInfo.getFrameworks('ios').filter(function(f) { return f.custom; });
+var invalid_custom_frameworks = faultyPluginInfo.getFrameworks('ios').filter(function (f) { return f.custom; });
var weblessPluginInfo = new PluginInfo(weblessplugin);
-function copyArray(arr) {
+function copyArray (arr) {
return Array.prototype.slice.call(arr, 0);
}
-function slashJoin() {
+function slashJoin () {
// In some places we need to use forward slash instead of path.join().
// See CB-7311.
return Array.prototype.join.call(arguments, '/');
}
-describe('ios plugin handler', function() {
+describe('ios plugin handler', function () {
var dummyProject;
- beforeEach(function() {
+ beforeEach(function () {
shell.cp('-rf', iosProject, temp);
projectFile.purgeProjectFileCache(temp);
@@ -77,151 +76,151 @@ describe('ios plugin handler', function() {
});
});
- afterEach(function() {
+ afterEach(function () {
shell.rm('-rf', temp);
});
- describe('installation', function() {
+ describe('installation', function () {
- describe('of <source-file> elements', function() {
+ describe('of <source-file> elements', function () {
var install = pluginHandlers.getInstaller('source-file');
beforeEach(function () {
spyOn(dummyProject.xcode, 'addSourceFile');
});
- it('Test 001 : should throw if source-file src cannot be found', function() {
+ it('Test 001 : should throw if source-file src cannot be found', function () {
var source = copyArray(invalid_source);
- expect(function() {
+ expect(function () {
install(source[1], faultyPluginInfo, dummyProject);
}).toThrow();
});
- it('Test 002 : should throw if source-file target already exists', function() {
+ it('Test 002 : should throw if source-file target already exists', function () {
var source = copyArray(valid_source);
var target = path.join(temp, 'SampleApp', 'Plugins', dummy_id, 'DummyPluginCommand.m');
shell.mkdir('-p', path.dirname(target));
fs.writeFileSync(target, 'some bs', 'utf-8');
- expect(function() {
+ expect(function () {
install(source[0], dummyPluginInfo, dummyProject);
}).toThrow();
});
- it('Test 003 : should call into xcodeproj\'s addSourceFile appropriately when element has no target-dir', function() {
- var source = copyArray(valid_source).filter(function(s) { return s.targetDir === undefined; });
+ it('Test 003 : should call into xcodeproj\'s addSourceFile appropriately when element has no target-dir', function () {
+ var source = copyArray(valid_source).filter(function (s) { return s.targetDir === undefined; });
install(source[0], dummyPluginInfo, dummyProject);
expect(dummyProject.xcode.addSourceFile)
.toHaveBeenCalledWith(slashJoin('Plugins', dummy_id, 'DummyPluginCommand.m'), {});
});
- it('Test 004 : should call into xcodeproj\'s addSourceFile appropriately when element has a target-dir', function() {
- var source = copyArray(valid_source).filter(function(s) { return s.targetDir !== undefined; });
+ it('Test 004 : should call into xcodeproj\'s addSourceFile appropriately when element has a target-dir', function () {
+ var source = copyArray(valid_source).filter(function (s) { return s.targetDir !== undefined; });
install(source[0], dummyPluginInfo, dummyProject);
expect(dummyProject.xcode.addSourceFile)
.toHaveBeenCalledWith(slashJoin('Plugins', dummy_id, 'targetDir', 'TargetDirTest.m'), {});
});
- it('Test 005 : should cp the file to the right target location when element has no target-dir', function() {
- var source = copyArray(valid_source).filter(function(s) { return s.targetDir === undefined; });
+ it('Test 005 : should cp the file to the right target location when element has no target-dir', function () {
+ var source = copyArray(valid_source).filter(function (s) { return s.targetDir === undefined; });
var spy = spyOn(shell, 'cp');
install(source[0], dummyPluginInfo, dummyProject);
expect(spy).toHaveBeenCalledWith('-f', path.join(dummyplugin, 'src', 'ios', 'DummyPluginCommand.m'), path.join(temp, 'SampleApp', 'Plugins', dummy_id, 'DummyPluginCommand.m'));
});
- it('Test 006 : should cp the file to the right target location when element has a target-dir', function() {
- var source = copyArray(valid_source).filter(function(s) { return s.targetDir !== undefined; });
+ it('Test 006 : should cp the file to the right target location when element has a target-dir', function () {
+ var source = copyArray(valid_source).filter(function (s) { return s.targetDir !== undefined; });
var spy = spyOn(shell, 'cp');
install(source[0], dummyPluginInfo, dummyProject);
expect(spy).toHaveBeenCalledWith('-f', path.join(dummyplugin, 'src', 'ios', 'TargetDirTest.m'), path.join(temp, 'SampleApp', 'Plugins', dummy_id, 'targetDir', 'TargetDirTest.m'));
});
- it('Test 007 : should call into xcodeproj\'s addFramework appropriately when element has framework=true set', function() {
- var source = copyArray(valid_source).filter(function(s) { return s.framework; });
+ it('Test 007 : should call into xcodeproj\'s addFramework appropriately when element has framework=true set', function () {
+ var source = copyArray(valid_source).filter(function (s) { return s.framework; });
spyOn(dummyProject.xcode, 'addFramework');
install(source[0], dummyPluginInfo, dummyProject);
expect(dummyProject.xcode.addFramework)
- .toHaveBeenCalledWith(path.join('SampleApp', 'Plugins', dummy_id, 'SourceWithFramework.m'), {weak:false});
+ .toHaveBeenCalledWith(path.join('SampleApp', 'Plugins', dummy_id, 'SourceWithFramework.m'), {weak: false});
});
});
- describe('of <header-file> elements', function() {
+ describe('of <header-file> elements', function () {
var install = pluginHandlers.getInstaller('header-file');
beforeEach(function () {
spyOn(dummyProject.xcode, 'addHeaderFile');
});
- it('Test 008 : should throw if header-file src cannot be found', function() {
+ it('Test 008 : should throw if header-file src cannot be found', function () {
var headers = copyArray(invalid_headers);
- expect(function() {
+ expect(function () {
install(headers[1], faultyPluginInfo, dummyProject);
}).toThrow();
});
- it('Test 009 : should throw if header-file target already exists', function() {
+ it('Test 009 : should throw if header-file target already exists', function () {
var headers = copyArray(valid_headers);
var target = path.join(temp, 'SampleApp', 'Plugins', dummy_id, 'DummyPluginCommand.h');
shell.mkdir('-p', path.dirname(target));
fs.writeFileSync(target, 'some bs', 'utf-8');
- expect(function() {
+ expect(function () {
install(headers[0], dummyPluginInfo, dummyProject);
}).toThrow();
});
- it('Test 010 : should call into xcodeproj\'s addHeaderFile appropriately when element has no target-dir', function() {
- var headers = copyArray(valid_headers).filter(function(s) { return s.targetDir === undefined; });
+ it('Test 010 : should call into xcodeproj\'s addHeaderFile appropriately when element has no target-dir', function () {
+ var headers = copyArray(valid_headers).filter(function (s) { return s.targetDir === undefined; });
install(headers[0], dummyPluginInfo, dummyProject);
expect(dummyProject.xcode.addHeaderFile)
.toHaveBeenCalledWith(slashJoin('Plugins', dummy_id, 'DummyPluginCommand.h'));
});
- it('Test 011 : should call into xcodeproj\'s addHeaderFile appropriately when element a target-dir', function() {
- var headers = copyArray(valid_headers).filter(function(s) { return s.targetDir !== undefined; });
+ it('Test 011 : should call into xcodeproj\'s addHeaderFile appropriately when element a target-dir', function () {
+ var headers = copyArray(valid_headers).filter(function (s) { return s.targetDir !== undefined; });
install(headers[0], dummyPluginInfo, dummyProject);
expect(dummyProject.xcode.addHeaderFile)
.toHaveBeenCalledWith(slashJoin('Plugins', dummy_id, 'targetDir', 'TargetDirTest.h'));
});
- it('Test 012 : should cp the file to the right target location when element has no target-dir', function() {
- var headers = copyArray(valid_headers).filter(function(s) { return s.targetDir === undefined; });
+ it('Test 012 : should cp the file to the right target location when element has no target-dir', function () {
+ var headers = copyArray(valid_headers).filter(function (s) { return s.targetDir === undefined; });
var spy = spyOn(shell, 'cp');
install(headers[0], dummyPluginInfo, dummyProject);
expect(spy).toHaveBeenCalledWith('-f', path.join(dummyplugin, 'src', 'ios', 'DummyPluginCommand.h'), path.join(temp, 'SampleApp', 'Plugins', dummy_id, 'DummyPluginCommand.h'));
});
- it('Test 013 : should cp the file to the right target location when element has a target-dir', function() {
- var headers = copyArray(valid_headers).filter(function(s) { return s.targetDir !== undefined; });
+ it('Test 013 : should cp the file to the right target location when element has a target-dir', function () {
+ var headers = copyArray(valid_headers).filter(function (s) { return s.targetDir !== undefined; });
var spy = spyOn(shell, 'cp');
install(headers[0], dummyPluginInfo, dummyProject);
expect(spy).toHaveBeenCalledWith('-f', path.join(dummyplugin, 'src', 'ios', 'TargetDirTest.h'), path.join(temp, 'SampleApp', 'Plugins', dummy_id, 'targetDir', 'TargetDirTest.h'));
});
});
- describe('of <resource-file> elements', function() {
+ describe('of <resource-file> elements', function () {
var install = pluginHandlers.getInstaller('resource-file');
beforeEach(function () {
spyOn(dummyProject.xcode, 'addResourceFile');
});
- it('Test 014 : should throw if resource-file src cannot be found', function() {
+ it('Test 014 : should throw if resource-file src cannot be found', function () {
var resources = copyArray(invalid_resources);
- expect(function() {
+ expect(function () {
install(resources[0], faultyPluginInfo, dummyProject);
- }).toThrow(new Error ('Cannot find resource file "' + path.resolve(faultyplugin, 'src/ios/IDontExist.bundle') + '" for plugin ' + faultyPluginInfo.id + ' in iOS platform'));
+ }).toThrow(new Error('Cannot find resource file "' + path.resolve(faultyplugin, 'src/ios/IDontExist.bundle') + '" for plugin ' + faultyPluginInfo.id + ' in iOS platform'));
});
- it('Test 015 : should throw if resource-file target already exists', function() {
+ it('Test 015 : should throw if resource-file target already exists', function () {
var resources = copyArray(valid_resources);
var target = path.join(temp, 'SampleApp', 'Resources', 'DummyPlugin.bundle');
shell.mkdir('-p', path.dirname(target));
fs.writeFileSync(target, 'some bs', 'utf-8');
- expect(function() {
+ expect(function () {
install(resources[0], dummyPluginInfo, dummyProject);
}).toThrow(new Error('File already exists at destination "' + target + '" for resource file specified by plugin ' + dummyPluginInfo.id + ' in iOS platform'));
});
- it('Test 016 : should call into xcodeproj\'s addResourceFile', function() {
+ it('Test 016 : should call into xcodeproj\'s addResourceFile', function () {
var resources = copyArray(valid_resources);
install(resources[0], dummyPluginInfo, dummyProject);
expect(dummyProject.xcode.addResourceFile)
.toHaveBeenCalledWith(path.join('Resources', 'DummyPlugin.bundle'));
});
- it('Test 017 : should cp the file to the right target location', function() {
+ it('Test 017 : should cp the file to the right target location', function () {
var resources = copyArray(valid_resources);
var spy = spyOn(shell, 'cp');
install(resources[0], dummyPluginInfo, dummyProject);
expect(spy).toHaveBeenCalledWith('-f', path.join(dummyplugin, 'src', 'ios', 'DummyPlugin.bundle'), path.join(temp, 'SampleApp', 'Resources', 'DummyPlugin.bundle'));
});
- it('Test 018 : should link files to the right target location', function() {
+ it('Test 018 : should link files to the right target location', function () {
var resources = copyArray(valid_resources);
var spy = spyOn(fs, 'linkSync');
install(resources[0], dummyPluginInfo, dummyProject, { link: true });
@@ -231,14 +230,14 @@ describe('ios plugin handler', function() {
});
});
- describe('of <framework> elements', function() {
+ describe('of <framework> elements', function () {
var install = pluginHandlers.getInstaller('framework');
beforeEach(function () {
spyOn(dummyProject.xcode, 'addFramework');
});
- it('Test 019 : should call into xcodeproj\'s addFramework', function() {
+ it('Test 019 : should call into xcodeproj\'s addFramework', function () {
var frameworks = copyArray(valid_custom_frameworks);
install(frameworks[0], dummyPluginInfo, dummyProject);
expect(dummyProject.xcode.addFramework)
@@ -260,29 +259,29 @@ describe('ios plugin handler', function() {
// * framework that shouldn't be added/removed
describe('with custom="true" attribute', function () {
- it('Test 020 : should throw if framework src cannot be found', function() {
+ it('Test 020 : should throw if framework src cannot be found', function () {
var frameworks = copyArray(invalid_custom_frameworks);
- expect(function() {
+ expect(function () {
install(frameworks[0], faultyPluginInfo, dummyProject);
- }).toThrow(new Error ('Cannot find framework "' + path.resolve(faultyplugin, 'src/ios/NonExistantCustomFramework.framework') + '" for plugin ' + faultyPluginInfo.id + ' in iOS platform'));
+ }).toThrow(new Error('Cannot find framework "' + path.resolve(faultyplugin, 'src/ios/NonExistantCustomFramework.framework') + '" for plugin ' + faultyPluginInfo.id + ' in iOS platform'));
});
- it('Test 021 : should throw if framework target already exists', function() {
+ it('Test 021 : should throw if framework target already exists', function () {
var frameworks = copyArray(valid_custom_frameworks);
var target = path.join(temp, 'SampleApp/Plugins/org.test.plugins.dummyplugin/Custom.framework');
shell.mkdir('-p', target);
- expect(function() {
+ expect(function () {
install(frameworks[0], dummyPluginInfo, dummyProject);
- }).toThrow(new Error ('Framework "' + target + '" for plugin ' + dummyPluginInfo.id + ' already exists in iOS platform'));
+ }).toThrow(new Error('Framework "' + target + '" for plugin ' + dummyPluginInfo.id + ' already exists in iOS platform'));
});
- it('Test 022 : should cp the file to the right target location', function() {
+ it('Test 022 : should cp the file to the right target location', function () {
var frameworks = copyArray(valid_custom_frameworks);
var spy = spyOn(shell, 'cp');
install(frameworks[0], dummyPluginInfo, dummyProject);
expect(spy).toHaveBeenCalledWith('-Rf', path.join(dummyplugin, 'src', 'ios', 'Custom.framework', '*'),
- path.join(temp, 'SampleApp/Plugins/org.test.plugins.dummyplugin/Custom.framework'));
+ path.join(temp, 'SampleApp/Plugins/org.test.plugins.dummyplugin/Custom.framework'));
});
- it('Test 023 : should deep symlink files to the right target location', function() {
+ it('Test 023 : should deep symlink files to the right target location', function () {
var frameworks = copyArray(valid_custom_frameworks);
var spy = spyOn(fs, 'linkSync');
install(frameworks[0], dummyPluginInfo, dummyProject, { link: true });
@@ -293,7 +292,7 @@ describe('ios plugin handler', function() {
});
});
- describe('of <js-module> elements', function() {
+ describe('of <js-module> elements', function () {
var jsModule = {src: 'www/dummyplugin.js'};
var install = pluginHandlers.getInstaller('js-module');
var wwwDest, platformWwwDest;
@@ -317,10 +316,13 @@ describe('ios plugin handler', function() {
});
});
- describe('of <asset> elements', function() {
+ describe('of <asset> elements', function () {
var asset = {src: 'www/dummyplugin.js', target: 'foo/dummy.js'};
var install = pluginHandlers.getInstaller('asset');
- var wwwDest, platformWwwDest;
+ /* eslint-disable no-unused-vars */
+ var wwwDest;
+ var platformWwwDest;
+ /* eslint-enable no-unused-vars */
beforeEach(function () {
spyOn(shell, 'cp');
@@ -341,115 +343,115 @@ describe('ios plugin handler', function() {
});
});
- it('Test 028 : of two plugins should apply xcode file changes from both', function(done){
+ it('Test 028 : of two plugins should apply xcode file changes from both', function (done) {
var api = new Api('ios', temp);
var fail = jasmine.createSpy('fail');
api.addPlugin(dummyPluginInfo)
- .then(function () {
- return api.addPlugin(weblessPluginInfo);
- })
- .fail(fail)
- .done(function() {
- expect(fail).not.toHaveBeenCalled();
-
- var xcode = projectFile.parse({
- root: temp,
- pbxproj: path.join(temp, 'SampleApp.xcodeproj/project.pbxproj')
- }).xcode;
-
- // from org.test.plugins.dummyplugin
- expect(xcode.hasFile(slashJoin('Resources', 'DummyPlugin.bundle'))).toEqual(jasmine.any(Object));
- expect(xcode.hasFile(slashJoin('Plugins','org.test.plugins.dummyplugin', 'DummyPluginCommand.h'))).toEqual(jasmine.any(Object));
- expect(xcode.hasFile(slashJoin('Plugins','org.test.plugins.dummyplugin', 'DummyPluginCommand.m'))).toEqual(jasmine.any(Object));
- expect(xcode.hasFile(slashJoin('Plugins','org.test.plugins.dummyplugin','targetDir','TargetDirTest.h'))).toEqual(jasmine.any(Object));
- expect(xcode.hasFile(slashJoin('Plugins','org.test.plugins.dummyplugin','targetDir','TargetDirTest.m'))).toEqual(jasmine.any(Object));
- expect(xcode.hasFile('usr/lib/libsqlite3.dylib')).toEqual(jasmine.any(Object));
- expect(xcode.hasFile(slashJoin('SampleApp','Plugins','org.test.plugins.dummyplugin','Custom.framework'))).toEqual(jasmine.any(Object));
- // from org.test.plugins.weblessplugin
- expect(xcode.hasFile(slashJoin('Resources', 'WeblessPluginViewController.xib'))).toEqual(jasmine.any(Object));
- expect(xcode.hasFile(slashJoin('Plugins','org.test.plugins.weblessplugin','WeblessPluginCommand.h'))).toEqual(jasmine.any(Object));
- expect(xcode.hasFile(slashJoin('Plugins','org.test.plugins.weblessplugin','WeblessPluginCommand.m'))).toEqual(jasmine.any(Object));
- expect(xcode.hasFile('usr/lib/libsqlite3.dylib')).toEqual(jasmine.any(Object));
-
- done();
- });
+ .then(function () {
+ return api.addPlugin(weblessPluginInfo);
+ })
+ .fail(fail)
+ .done(function () {
+ expect(fail).not.toHaveBeenCalled();
+
+ var xcode = projectFile.parse({
+ root: temp,
+ pbxproj: path.join(temp, 'SampleApp.xcodeproj/project.pbxproj')
+ }).xcode;
+
+ // from org.test.plugins.dummyplugin
+ expect(xcode.hasFile(slashJoin('Resources', 'DummyPlugin.bundle'))).toEqual(jasmine.any(Object));
+ expect(xcode.hasFile(slashJoin('Plugins', 'org.test.plugins.dummyplugin', 'DummyPluginCommand.h'))).toEqual(jasmine.any(Object));
+ expect(xcode.hasFile(slashJoin('Plugins', 'org.test.plugins.dummyplugin', 'DummyPluginCommand.m'))).toEqual(jasmine.any(Object));
+ expect(xcode.hasFile(slashJoin('Plugins', 'org.test.plugins.dummyplugin', 'targetDir', 'TargetDirTest.h'))).toEqual(jasmine.any(Object));
+ expect(xcode.hasFile(slashJoin('Plugins', 'org.test.plugins.dummyplugin', 'targetDir', 'TargetDirTest.m'))).toEqual(jasmine.any(Object));
+ expect(xcode.hasFile('usr/lib/libsqlite3.dylib')).toEqual(jasmine.any(Object));
+ expect(xcode.hasFile(slashJoin('SampleApp', 'Plugins', 'org.test.plugins.dummyplugin', 'Custom.framework'))).toEqual(jasmine.any(Object));
+ // from org.test.plugins.weblessplugin
+ expect(xcode.hasFile(slashJoin('Resources', 'WeblessPluginViewController.xib'))).toEqual(jasmine.any(Object));
+ expect(xcode.hasFile(slashJoin('Plugins', 'org.test.plugins.weblessplugin', 'WeblessPluginCommand.h'))).toEqual(jasmine.any(Object));
+ expect(xcode.hasFile(slashJoin('Plugins', 'org.test.plugins.weblessplugin', 'WeblessPluginCommand.m'))).toEqual(jasmine.any(Object));
+ expect(xcode.hasFile('usr/lib/libsqlite3.dylib')).toEqual(jasmine.any(Object));
+
+ done();
+ });
});
});
- describe('uninstallation', function() {
- describe('of <source-file> elements', function() {
+ describe('uninstallation', function () {
+ describe('of <source-file> elements', function () {
var uninstall = pluginHandlers.getUninstaller('source-file');
beforeEach(function () {
spyOn(dummyProject.xcode, 'removeSourceFile');
spyOn(dummyProject.xcode, 'removeFramework');
});
- it('Test 029 : should call into xcodeproj\'s removeSourceFile appropriately when element has no target-dir', function(){
- var source = copyArray(valid_source).filter(function(s) { return s.targetDir === undefined; });
+ it('Test 029 : should call into xcodeproj\'s removeSourceFile appropriately when element has no target-dir', function () {
+ var source = copyArray(valid_source).filter(function (s) { return s.targetDir === undefined; });
uninstall(source[0], dummyPluginInfo, dummyProject);
expect(dummyProject.xcode.removeSourceFile).toHaveBeenCalledWith(slashJoin('Plugins', dummy_id, 'DummyPluginCommand.m'));
});
- it('Test 030 : should call into xcodeproj\'s removeSourceFile appropriately when element a target-dir', function(){
- var source = copyArray(valid_source).filter(function(s) { return s.targetDir !== undefined; });
+ it('Test 030 : should call into xcodeproj\'s removeSourceFile appropriately when element a target-dir', function () {
+ var source = copyArray(valid_source).filter(function (s) { return s.targetDir !== undefined; });
uninstall(source[0], dummyPluginInfo, dummyProject);
expect(dummyProject.xcode.removeSourceFile).toHaveBeenCalledWith(slashJoin('Plugins', dummy_id, 'targetDir', 'TargetDirTest.m'));
});
- it('Test 031 : should rm the file from the right target location when element has no target-dir', function(){
- var source = copyArray(valid_source).filter(function(s) { return s.targetDir === undefined; });
+ it('Test 031 : should rm the file from the right target location when element has no target-dir', function () {
+ var source = copyArray(valid_source).filter(function (s) { return s.targetDir === undefined; });
var spy = spyOn(shell, 'rm');
uninstall(source[0], dummyPluginInfo, dummyProject);
expect(spy).toHaveBeenCalledWith('-rf', path.join(temp, 'SampleApp', 'Plugins', dummy_id));
});
- it('Test 032 : should rm the file from the right target location when element has a target-dir', function(){
- var source = copyArray(valid_source).filter(function(s) { return s.targetDir !== undefined; });
+ it('Test 032 : should rm the file from the right target location when element has a target-dir', function () {
+ var source = copyArray(valid_source).filter(function (s) { return s.targetDir !== undefined; });
var spy = spyOn(shell, 'rm');
uninstall(source[0], dummyPluginInfo, dummyProject);
expect(spy).toHaveBeenCalledWith('-rf', path.join(temp, 'SampleApp', 'Plugins', dummy_id, 'targetDir'));
});
- it('Test 033 : should call into xcodeproj\'s removeFramework appropriately when element framework=true set', function(){
- var source = copyArray(valid_source).filter(function(s) { return s.framework; });
+ it('Test 033 : should call into xcodeproj\'s removeFramework appropriately when element framework=true set', function () {
+ var source = copyArray(valid_source).filter(function (s) { return s.framework; });
uninstall(source[0], dummyPluginInfo, dummyProject);
expect(dummyProject.xcode.removeFramework).toHaveBeenCalledWith(path.join('SampleApp', 'Plugins', dummy_id, 'SourceWithFramework.m'));
});
});
- describe('of <header-file> elements', function() {
+ describe('of <header-file> elements', function () {
var uninstall = pluginHandlers.getUninstaller('header-file');
beforeEach(function () {
spyOn(dummyProject.xcode, 'removeHeaderFile');
});
- it('Test 034 : should call into xcodeproj\'s removeHeaderFile appropriately when element has no target-dir', function(){
- var headers = copyArray(valid_headers).filter(function(s) { return s.targetDir === undefined; });
+ it('Test 034 : should call into xcodeproj\'s removeHeaderFile appropriately when element has no target-dir', function () {
+ var headers = copyArray(valid_headers).filter(function (s) { return s.targetDir === undefined; });
uninstall(headers[0], dummyPluginInfo, dummyProject);
expect(dummyProject.xcode.removeHeaderFile).toHaveBeenCalledWith(slashJoin('Plugins', dummy_id, 'DummyPluginCommand.h'));
});
- it('Test 035 : should call into xcodeproj\'s removeHeaderFile appropriately when element a target-dir', function(){
- var headers = copyArray(valid_headers).filter(function(s) { return s.targetDir !== undefined; });
+ it('Test 035 : should call into xcodeproj\'s removeHeaderFile appropriately when element a target-dir', function () {
+ var headers = copyArray(valid_headers).filter(function (s) { return s.targetDir !== undefined; });
uninstall(headers[0], dummyPluginInfo, dummyProject);
expect(dummyProject.xcode.removeHeaderFile).toHaveBeenCalledWith(slashJoin('Plugins', dummy_id, 'targetDir', 'TargetDirTest.h'));
});
- it('Test 036 : should rm the file from the right target location', function(){
- var headers = copyArray(valid_headers).filter(function(s) { return s.targetDir !== undefined; });
+ it('Test 036 : should rm the file from the right target location', function () {
+ var headers = copyArray(valid_headers).filter(function (s) { return s.targetDir !== undefined; });
var spy = spyOn(shell, 'rm');
uninstall(headers[0], dummyPluginInfo, dummyProject);
expect(spy).toHaveBeenCalledWith('-rf', path.join(temp, 'SampleApp', 'Plugins', dummy_id, 'targetDir'));
});
});
- describe('of <resource-file> elements', function() {
+ describe('of <resource-file> elements', function () {
var uninstall = pluginHandlers.getUninstaller('resource-file');
beforeEach(function () {
spyOn(dummyProject.xcode, 'removeResourceFile');
});
- it('Test 037 : should call into xcodeproj\'s removeResourceFile', function(){
+ it('Test 037 : should call into xcodeproj\'s removeResourceFile', function () {
var resources = copyArray(valid_resources);
uninstall(resources[0], dummyPluginInfo, dummyProject);
expect(dummyProject.xcode.removeResourceFile).toHaveBeenCalledWith(path.join('Resources', 'DummyPlugin.bundle'));
});
- it('Test 038 : should rm the file from the right target location', function(){
+ it('Test 038 : should rm the file from the right target location', function () {
var resources = copyArray(valid_resources);
var spy = spyOn(shell, 'rm');
uninstall(resources[0], dummyPluginInfo, dummyProject);
@@ -457,7 +459,7 @@ describe('ios plugin handler', function() {
});
});
- describe('of <framework> elements', function() {
+ describe('of <framework> elements', function () {
var uninstall = pluginHandlers.getUninstaller('framework');
beforeEach(function () {
spyOn(dummyProject.xcode, 'removeFramework');
@@ -465,10 +467,10 @@ describe('ios plugin handler', function() {
var frameworkPath = path.join(temp, 'SampleApp/Plugins/org.test.plugins.dummyplugin/Custom.framework').replace(/\\/g, '/');
- it('Test 039 : should call into xcodeproj\'s removeFramework', function(){
+ it('Test 039 : should call into xcodeproj\'s removeFramework', function () {
var frameworks = copyArray(valid_custom_frameworks);
uninstall(frameworks[0], dummyPluginInfo, dummyProject);
- expect(dummyProject.xcode.removeFramework).toHaveBeenCalledWith(frameworkPath, {customFramework:true});
+ expect(dummyProject.xcode.removeFramework).toHaveBeenCalledWith(frameworkPath, {customFramework: true});
});
// TODO: Add more tests to cover the cases:
@@ -476,7 +478,7 @@ describe('ios plugin handler', function() {
// * framework that shouldn't be added/removed
describe('with custom="true" attribute', function () {
- it('Test 040 : should rm the file from the right target location', function(){
+ it('Test 040 : should rm the file from the right target location', function () {
var frameworks = copyArray(valid_custom_frameworks);
var spy = spyOn(shell, 'rm');
uninstall(frameworks[0], dummyPluginInfo, dummyProject);
@@ -484,11 +486,11 @@ describe('ios plugin handler', function() {
});
});
- describe('without custom="true" attribute ', function() {
+ describe('without custom="true" attribute ', function () {
- it('Test 041 : should decrease framework counter after uninstallation', function() {
+ it('Test 041 : should decrease framework counter after uninstallation', function () {
var install = pluginHandlers.getInstaller('framework');
- var dummyNonCustomFrameworks = dummyPluginInfo.getFrameworks('ios').filter(function(f) {
+ var dummyNonCustomFrameworks = dummyPluginInfo.getFrameworks('ios').filter(function (f) {
return !f.custom;
});
var dummyFramework = dummyNonCustomFrameworks[0];
@@ -504,7 +506,7 @@ describe('ios plugin handler', function() {
});
});
- describe('of <js-module> elements', function() {
+ describe('of <js-module> elements', function () {
var jsModule = {src: 'www/dummyPlugin.js'};
var uninstall = pluginHandlers.getUninstaller('js-module');
var wwwDest, platformWwwDest;
@@ -517,7 +519,7 @@ describe('ios plugin handler', function() {
var existsSyncOrig = fs.existsSync;
spyOn(fs, 'existsSync').and.callFake(function (file) {
- if ([wwwDest, platformWwwDest].indexOf(file) >= 0 ) return true;
+ if ([wwwDest, platformWwwDest].indexOf(file) >= 0) return true;
return existsSyncOrig.call(fs, file);
});
});
@@ -535,7 +537,7 @@ describe('ios plugin handler', function() {
});
});
- describe('of <asset> elements', function() {
+ describe('of <asset> elements', function () {
var asset = {src: 'www/dummyPlugin.js', target: 'foo/dummy.js'};
var uninstall = pluginHandlers.getUninstaller('asset');
var wwwDest, platformWwwDest;
@@ -548,7 +550,7 @@ describe('ios plugin handler', function() {
var existsSyncOrig = fs.existsSync;
spyOn(fs, 'existsSync').and.callFake(function (file) {
- if ([wwwDest, platformWwwDest].indexOf(file) >= 0 ) return true;
+ if ([wwwDest, platformWwwDest].indexOf(file) >= 0) return true;
return existsSyncOrig.call(fs, file);
});
});
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/83435d56/tests/spec/unit/Podfile.spec.js
----------------------------------------------------------------------
diff --git a/tests/spec/unit/Podfile.spec.js b/tests/spec/unit/Podfile.spec.js
index 4cf0b34..b1fb13d 100644
--- a/tests/spec/unit/Podfile.spec.js
+++ b/tests/spec/unit/Podfile.spec.js
@@ -17,10 +17,10 @@
under the License.
*/
-var path = require('path'),
- util = require('util'),
- fs = require('fs'),
- CordovaError = require('cordova-common').CordovaError;
+var path = require('path');
+var util = require('util');
+var fs = require('fs');
+var CordovaError = require('cordova-common').CordovaError;
var PROJECT_NAME = 'testProj';
var Podfile = require(path.resolve(path.join(__dirname, '..', '..', '..', 'bin', 'templates', 'scripts', 'cordova', 'lib', 'Podfile.js'))).Podfile;
@@ -28,130 +28,124 @@ var fixturePodfile = path.resolve(__dirname, 'fixtures', PROJECT_NAME, 'platform
var fixturePodXcconfigDebug = path.resolve(__dirname, 'fixtures', PROJECT_NAME, 'platforms', 'ios', 'pods-debug.xcconfig');
var fixturePodXcconfigRelease = path.resolve(__dirname, 'fixtures', PROJECT_NAME, 'platforms', 'ios', 'pods-release.xcconfig');
-
// tests are nested in a describe to ensure clean up happens after all unit tests are run
describe('unit tests for Podfile module', function () {
- var podfile = new Podfile(fixturePodfile, PROJECT_NAME);
-
- describe('tests', function () {
-
- it ('Test 001 : throws CordovaError when the path filename is not named Podfile', function () {
- var dummyPath = 'NotAPodfile';
- expect( function () {
- new Podfile(dummyPath);
- })
- .toThrow(new CordovaError(util.format('Podfile: The file at %s is not `%s`.', dummyPath, Podfile.FILENAME)));
- });
-
- it ('Test 002 : throws CordovaError when no projectName provided when creating a Podfile', function () {
- expect( function () {
- new Podfile(fixturePodfile);
- })
- .toThrow(new CordovaError('Podfile: The projectName was not specified in the constructor.'));
- });
-
- it ('Test 003 : throws CordovaError when no pod name provided when adding a spec', function () {
- expect( function () {
- podfile.addSpec(null);
- })
- .toThrow(new CordovaError('Podfile addSpec: name is not specified.'));
- });
-
- it ('Test 004 : adds the spec', function () {
- expect(podfile.existsSpec('Foo')).toBe(false);
- podfile.addSpec('Foo', '1.0');
- expect(podfile.existsSpec('Foo')).toBe(true);
- });
-
- it ('Test 005 : removes the spec', function () {
- podfile.addSpec('Baz', '3.0');
- expect(podfile.existsSpec('Baz')).toBe(true);
- podfile.removeSpec('Baz');
- expect(podfile.existsSpec('Baz')).toBe(false);
- });
-
- it ('Test 006 : clears all specs', function () {
- podfile.addSpec('Bar', '2.0');
- podfile.clear();
-
- expect(podfile.existsSpec('Foo')).toBe(false);
- expect(podfile.existsSpec('Bar')).toBe(false);
- });
-
- it ('Test 007 : isDirty tests', function () {
- podfile.addSpec('Foo', '1.0');
- expect(podfile.isDirty()).toBe(true);
-
- podfile.write();
- expect(podfile.isDirty()).toBe(false);
-
- podfile.removeSpec('Foo');
- expect(podfile.isDirty()).toBe(true);
-
- podfile.clear();
- expect(podfile.isDirty()).toBe(true);
-
- podfile.write();
- expect(podfile.isDirty()).toBe(false);
- });
-
- it ('Test 008 : writes specs to the Podfile', function () {
- podfile.clear();
-
- podfile.addSpec('Foo', '1.0');
- podfile.addSpec('Bar', '2.0');
- podfile.addSpec('Baz', '3.0');
- podfile.addSpec('Foo-Baz', '4.0');
- podfile.addSpec('Foo~Baz@!%@!%!', '5.0');
- podfile.addSpec('Bla', ':configurations => [\'Debug\', \'Beta\']');
-
- podfile.write();
-
- // verify by reading it back in a new Podfile
- var newPodfile = new Podfile(fixturePodfile, PROJECT_NAME + '2');
- expect(newPodfile.existsSpec('Foo')).toBe(true);
- expect(newPodfile.existsSpec('Bar')).toBe(true);
- expect(newPodfile.existsSpec('Baz')).toBe(true);
- expect(newPodfile.existsSpec('Foo-Baz')).toBe(true);
- expect(newPodfile.existsSpec('Foo~Baz@!%@!%!')).toBe(true);
- expect(newPodfile.existsSpec('Bla')).toBe(true);
-
- expect(newPodfile.getSpec('Foo')).toBe(podfile.getSpec('Foo'));
- expect(newPodfile.getSpec('Bar')).toBe(podfile.getSpec('Bar'));
- expect(newPodfile.getSpec('Baz')).toBe(podfile.getSpec('Baz'));
- expect(newPodfile.getSpec('Foo-Baz')).toBe(podfile.getSpec('Foo-Baz'));
- expect(newPodfile.getSpec('Foo~Baz@!%@!%!')).toBe(podfile.getSpec('Foo~Baz@!%@!%!'));
- expect(newPodfile.getSpec('Bla')).toBe(podfile.getSpec('Bla'));
- });
-
- it ('Test 009 : runs before_install to install xcconfig paths', function () {
- podfile.before_install();
-
- // Template tokens in order: project name, project name, debug | release
- var template =
- '// DO NOT MODIFY -- auto-generated by Apache Cordova\n' +
- '#include "Pods/Target Support Files/Pods-%s/Pods-%s.%s.xcconfig"';
-
- var expectedDebugContents = util.format(template, PROJECT_NAME, PROJECT_NAME, 'debug');
- var expectedReleaseContents = util.format(template, PROJECT_NAME, PROJECT_NAME, 'release');
-
- var actualDebugContents = fs.readFileSync(fixturePodXcconfigDebug, 'utf8');
- var actualReleaseContents = fs.readFileSync(fixturePodXcconfigRelease, 'utf8');
-
- expect(actualDebugContents).toBe(expectedDebugContents);
- expect(actualReleaseContents).toBe(expectedReleaseContents);
- });
-
-
- });
-
- it('Test 010 : tear down', function () {
- podfile.destroy();
-
- var text = '// DO NOT MODIFY -- auto-generated by Apache Cordova\n';
-
- fs.writeFileSync(fixturePodXcconfigDebug, text, 'utf8');
- fs.writeFileSync(fixturePodXcconfigRelease, text, 'utf8');
- });
+ var podfile = new Podfile(fixturePodfile, PROJECT_NAME);
+
+ describe('tests', function () {
+
+ it('Test 001 : throws CordovaError when the path filename is not named Podfile', function () {
+ var dummyPath = 'NotAPodfile';
+ expect(function () {
+ new Podfile(dummyPath); /* eslint no-new : 0 */
+ }).toThrow(new CordovaError(util.format('Podfile: The file at %s is not `%s`.', dummyPath, Podfile.FILENAME)));
+ });
+
+ it('Test 002 : throws CordovaError when no projectName provided when creating a Podfile', function () {
+ expect(function () {
+ new Podfile(fixturePodfile); /* eslint no-new : 0 */
+ }).toThrow(new CordovaError('Podfile: The projectName was not specified in the constructor.'));
+ });
+
+ it('Test 003 : throws CordovaError when no pod name provided when adding a spec', function () {
+ expect(function () {
+ podfile.addSpec(null);
+ }).toThrow(new CordovaError('Podfile addSpec: name is not specified.'));
+ });
+
+ it('Test 004 : adds the spec', function () {
+ expect(podfile.existsSpec('Foo')).toBe(false);
+ podfile.addSpec('Foo', '1.0');
+ expect(podfile.existsSpec('Foo')).toBe(true);
+ });
+
+ it('Test 005 : removes the spec', function () {
+ podfile.addSpec('Baz', '3.0');
+ expect(podfile.existsSpec('Baz')).toBe(true);
+ podfile.removeSpec('Baz');
+ expect(podfile.existsSpec('Baz')).toBe(false);
+ });
+
+ it('Test 006 : clears all specs', function () {
+ podfile.addSpec('Bar', '2.0');
+ podfile.clear();
+
+ expect(podfile.existsSpec('Foo')).toBe(false);
+ expect(podfile.existsSpec('Bar')).toBe(false);
+ });
+
+ it('Test 007 : isDirty tests', function () {
+ podfile.addSpec('Foo', '1.0');
+ expect(podfile.isDirty()).toBe(true);
+
+ podfile.write();
+ expect(podfile.isDirty()).toBe(false);
+
+ podfile.removeSpec('Foo');
+ expect(podfile.isDirty()).toBe(true);
+
+ podfile.clear();
+ expect(podfile.isDirty()).toBe(true);
+
+ podfile.write();
+ expect(podfile.isDirty()).toBe(false);
+ });
+
+ it('Test 008 : writes specs to the Podfile', function () {
+ podfile.clear();
+
+ podfile.addSpec('Foo', '1.0');
+ podfile.addSpec('Bar', '2.0');
+ podfile.addSpec('Baz', '3.0');
+ podfile.addSpec('Foo-Baz', '4.0');
+ podfile.addSpec('Foo~Baz@!%@!%!', '5.0');
+ podfile.addSpec('Bla', ':configurations => [\'Debug\', \'Beta\']');
+
+ podfile.write();
+
+ // verify by reading it back in a new Podfile
+ var newPodfile = new Podfile(fixturePodfile, PROJECT_NAME + '2');
+ expect(newPodfile.existsSpec('Foo')).toBe(true);
+ expect(newPodfile.existsSpec('Bar')).toBe(true);
+ expect(newPodfile.existsSpec('Baz')).toBe(true);
+ expect(newPodfile.existsSpec('Foo-Baz')).toBe(true);
+ expect(newPodfile.existsSpec('Foo~Baz@!%@!%!')).toBe(true);
+ expect(newPodfile.existsSpec('Bla')).toBe(true);
+
+ expect(newPodfile.getSpec('Foo')).toBe(podfile.getSpec('Foo'));
+ expect(newPodfile.getSpec('Bar')).toBe(podfile.getSpec('Bar'));
+ expect(newPodfile.getSpec('Baz')).toBe(podfile.getSpec('Baz'));
+ expect(newPodfile.getSpec('Foo-Baz')).toBe(podfile.getSpec('Foo-Baz'));
+ expect(newPodfile.getSpec('Foo~Baz@!%@!%!')).toBe(podfile.getSpec('Foo~Baz@!%@!%!'));
+ expect(newPodfile.getSpec('Bla')).toBe(podfile.getSpec('Bla'));
+ });
+
+ it('Test 009 : runs before_install to install xcconfig paths', function () {
+ podfile.before_install();
+
+ // Template tokens in order: project name, project name, debug | release
+ var template =
+ '// DO NOT MODIFY -- auto-generated by Apache Cordova\n' +
+ '#include "Pods/Target Support Files/Pods-%s/Pods-%s.%s.xcconfig"';
+
+ var expectedDebugContents = util.format(template, PROJECT_NAME, PROJECT_NAME, 'debug');
+ var expectedReleaseContents = util.format(template, PROJECT_NAME, PROJECT_NAME, 'release');
+
+ var actualDebugContents = fs.readFileSync(fixturePodXcconfigDebug, 'utf8');
+ var actualReleaseContents = fs.readFileSync(fixturePodXcconfigRelease, 'utf8');
+
+ expect(actualDebugContents).toBe(expectedDebugContents);
+ expect(actualReleaseContents).toBe(expectedReleaseContents);
+ });
+
+ });
+
+ it('Test 010 : tear down', function () {
+ podfile.destroy();
+
+ var text = '// DO NOT MODIFY -- auto-generated by Apache Cordova\n';
+
+ fs.writeFileSync(fixturePodXcconfigDebug, text, 'utf8');
+ fs.writeFileSync(fixturePodXcconfigRelease, text, 'utf8');
+ });
});
-
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/83435d56/tests/spec/unit/PodsJson.spec.js
----------------------------------------------------------------------
diff --git a/tests/spec/unit/PodsJson.spec.js b/tests/spec/unit/PodsJson.spec.js
index aa9b9ca..2543323 100644
--- a/tests/spec/unit/PodsJson.spec.js
+++ b/tests/spec/unit/PodsJson.spec.js
@@ -17,171 +17,169 @@
under the License.
*/
-var path = require('path'),
- util = require('util'),
- CordovaError = require('cordova-common').CordovaError;
+var path = require('path');
+var util = require('util');
+var CordovaError = require('cordova-common').CordovaError;
var PodsJson = require(path.resolve(path.join(__dirname, '..', '..', '..', 'bin', 'templates', 'scripts', 'cordova', 'lib', 'PodsJson.js'))).PodsJson;
var fixturePodsJson = path.resolve(__dirname, 'fixtures', 'testProj', 'platforms', 'ios', 'pods.json');
// tests are nested in a describe to ensure clean up happens after all unit tests are run
describe('unit tests for Podfile module', function () {
- var podsjson = new PodsJson(fixturePodsJson);
-
- describe('tests', function () {
-
- it ('Test 001 : throws CordovaError when the path filename is not named pods.json', function () {
- var dummyPath = 'NotPodsJson';
- expect( function () {
- new PodsJson(dummyPath);
- })
- .toThrow(new CordovaError(util.format('PodsJson: The file at %s is not `%s`.', dummyPath, PodsJson.FILENAME)));
- });
-
- it ('Test 002 : sets and gets pod test', function () {
- var val0 = {
- name: 'Foo',
- type: 'podspec',
- spec: '1.0',
- count: 1
- };
- podsjson.set(val0.name, val0.type, val0.spec, val0.count);
- var val1 = podsjson.get(val0.name);
-
- expect(val1).toBeTruthy();
- expect(val1.name).toEqual(val0.name);
- expect(val1.type).toEqual(val0.type);
- expect(val1.spec).toEqual(val0.spec);
- expect(val1.count).toEqual(val0.count);
- });
-
- it ('Test 003 : setsJson and remove pod test', function () {
- var val0 = {
- name: 'Bar',
- type: 'podspec',
- spec: '2.0',
- count: 2
- };
- podsjson.setJson(val0.name, val0);
- var val1 = podsjson.get(val0.name);
-
- expect(val1).toBeTruthy();
- expect(val1.name).toEqual(val0.name);
- expect(val1.type).toEqual(val0.type);
- expect(val1.spec).toEqual(val0.spec);
- expect(val1.count).toEqual(val0.count);
-
- podsjson.remove(val0.name);
- val1 = podsjson.get(val0.name);
- expect(val1).toBeFalsy();
- });
-
- it ('Test 004 : clears all pods', function () {
- var val0 = {
- name: 'Baz',
- type: 'podspec',
- spec: '3.0',
- count: 3
- };
- podsjson.setJson(val0.name, val0);
- podsjson.clear();
-
- expect(podsjson.get(val0.name)).toBeFalsy();
- expect(podsjson.get('Foo')).toBeFalsy();
- expect(podsjson.get('Bar')).toBeFalsy();
- });
-
- it ('Test 005 : isDirty tests', function () {
- var val0 = {
- name: 'Foo',
- type: 'podspec',
- spec: '1.0',
- count: 1
- };
-
- podsjson.setJson(val0.name, val0);
- expect(podsjson.isDirty()).toBe(true);
-
- podsjson.write();
- expect(podsjson.isDirty()).toBe(false);
-
- podsjson.remove(val0.name);
- expect(podsjson.isDirty()).toBe(true);
-
- podsjson.clear();
- expect(podsjson.isDirty()).toBe(true);
-
- podsjson.write();
- expect(podsjson.isDirty()).toBe(false);
- });
-
- it ('Test 006 : increment and decrement count test', function () {
- var val0 = {
- name: 'Bla',
- type: 'podspec',
- spec: '4.0',
- count: 4
- };
-
- podsjson.setJson(val0.name, val0);
- expect(podsjson.get(val0.name).count).toBe(4);
-
- podsjson.increment(val0.name);
- expect(podsjson.get(val0.name).count).toBe(5);
-
- podsjson.decrement(val0.name);
- expect(podsjson.get(val0.name).count).toBe(4);
- podsjson.decrement(val0.name);
- expect(podsjson.get(val0.name).count).toBe(3);
- podsjson.decrement(val0.name);
- expect(podsjson.get(val0.name).count).toBe(2);
- podsjson.decrement(val0.name);
- expect(podsjson.get(val0.name).count).toBe(1);
-
- // this next decrement takes it down to zero, where the pod will just be removed
- podsjson.decrement(val0.name);
- expect(podsjson.get(val0.name)).toBeFalsy();
- });
-
- it ('Test 007 : writes pods to the pods.json', function () {
- podsjson.clear();
-
- var vals = {
- 'Foo': { name: 'Foo', type: 'podspec', spec: '1.0', count: 1 },
- 'Bar': { name: 'Bar', type: 'podspec', spec: '2.0', count: 2 },
- 'Baz': { name: 'Baz', type: 'podspec', spec: '3.0', count: 3 }
- };
-
- podsjson.setJson('Foo', vals.Foo);
- podsjson.setJson('Bar', vals.Bar);
- podsjson.setJson('Baz', vals.Baz);
-
- podsjson.write();
-
- // verify by reading it back in a new PodsJson
- var newPodsJson = new PodsJson(fixturePodsJson);
- expect(newPodsJson.get('Foo')).toBeTruthy();
- expect(newPodsJson.get('Bar')).toBeTruthy();
- expect(newPodsJson.get('Baz')).toBeTruthy();
-
- function podEqual(a, b) {
- return (
- a.name === b.name &&
- a.type === b.type &&
- a.spec === b.spec &&
- a.count === b.count
- );
- }
-
- expect(podEqual(podsjson.get('Foo'), newPodsJson.get('Foo'))).toBe(true);
- expect(podEqual(podsjson.get('Bar'), newPodsJson.get('Bar'))).toBe(true);
- expect(podEqual(podsjson.get('Baz'), newPodsJson.get('Baz'))).toBe(true);
- });
-
- });
-
- it('Test 008 : tear down', function () {
- podsjson.destroy();
- });
+ var podsjson = new PodsJson(fixturePodsJson);
+
+ describe('tests', function () {
+
+ it('Test 001 : throws CordovaError when the path filename is not named pods.json', function () {
+ var dummyPath = 'NotPodsJson';
+ expect(function () {
+ new PodsJson(dummyPath); /* eslint no-new : 0 */
+ }).toThrow(new CordovaError(util.format('PodsJson: The file at %s is not `%s`.', dummyPath, PodsJson.FILENAME)));
+ });
+
+ it('Test 002 : sets and gets pod test', function () {
+ var val0 = {
+ name: 'Foo',
+ type: 'podspec',
+ spec: '1.0',
+ count: 1
+ };
+ podsjson.set(val0.name, val0.type, val0.spec, val0.count);
+ var val1 = podsjson.get(val0.name);
+
+ expect(val1).toBeTruthy();
+ expect(val1.name).toEqual(val0.name);
+ expect(val1.type).toEqual(val0.type);
+ expect(val1.spec).toEqual(val0.spec);
+ expect(val1.count).toEqual(val0.count);
+ });
+
+ it('Test 003 : setsJson and remove pod test', function () {
+ var val0 = {
+ name: 'Bar',
+ type: 'podspec',
+ spec: '2.0',
+ count: 2
+ };
+ podsjson.setJson(val0.name, val0);
+ var val1 = podsjson.get(val0.name);
+
+ expect(val1).toBeTruthy();
+ expect(val1.name).toEqual(val0.name);
+ expect(val1.type).toEqual(val0.type);
+ expect(val1.spec).toEqual(val0.spec);
+ expect(val1.count).toEqual(val0.count);
+
+ podsjson.remove(val0.name);
+ val1 = podsjson.get(val0.name);
+ expect(val1).toBeFalsy();
+ });
+
+ it('Test 004 : clears all pods', function () {
+ var val0 = {
+ name: 'Baz',
+ type: 'podspec',
+ spec: '3.0',
+ count: 3
+ };
+ podsjson.setJson(val0.name, val0);
+ podsjson.clear();
+
+ expect(podsjson.get(val0.name)).toBeFalsy();
+ expect(podsjson.get('Foo')).toBeFalsy();
+ expect(podsjson.get('Bar')).toBeFalsy();
+ });
+
+ it('Test 005 : isDirty tests', function () {
+ var val0 = {
+ name: 'Foo',
+ type: 'podspec',
+ spec: '1.0',
+ count: 1
+ };
+
+ podsjson.setJson(val0.name, val0);
+ expect(podsjson.isDirty()).toBe(true);
+
+ podsjson.write();
+ expect(podsjson.isDirty()).toBe(false);
+
+ podsjson.remove(val0.name);
+ expect(podsjson.isDirty()).toBe(true);
+
+ podsjson.clear();
+ expect(podsjson.isDirty()).toBe(true);
+
+ podsjson.write();
+ expect(podsjson.isDirty()).toBe(false);
+ });
+
+ it('Test 006 : increment and decrement count test', function () {
+ var val0 = {
+ name: 'Bla',
+ type: 'podspec',
+ spec: '4.0',
+ count: 4
+ };
+
+ podsjson.setJson(val0.name, val0);
+ expect(podsjson.get(val0.name).count).toBe(4);
+
+ podsjson.increment(val0.name);
+ expect(podsjson.get(val0.name).count).toBe(5);
+
+ podsjson.decrement(val0.name);
+ expect(podsjson.get(val0.name).count).toBe(4);
+ podsjson.decrement(val0.name);
+ expect(podsjson.get(val0.name).count).toBe(3);
+ podsjson.decrement(val0.name);
+ expect(podsjson.get(val0.name).count).toBe(2);
+ podsjson.decrement(val0.name);
+ expect(podsjson.get(val0.name).count).toBe(1);
+
+ // this next decrement takes it down to zero, where the pod will just be removed
+ podsjson.decrement(val0.name);
+ expect(podsjson.get(val0.name)).toBeFalsy();
+ });
+
+ it('Test 007 : writes pods to the pods.json', function () {
+ podsjson.clear();
+
+ var vals = {
+ 'Foo': { name: 'Foo', type: 'podspec', spec: '1.0', count: 1 },
+ 'Bar': { name: 'Bar', type: 'podspec', spec: '2.0', count: 2 },
+ 'Baz': { name: 'Baz', type: 'podspec', spec: '3.0', count: 3 }
+ };
+
+ podsjson.setJson('Foo', vals.Foo);
+ podsjson.setJson('Bar', vals.Bar);
+ podsjson.setJson('Baz', vals.Baz);
+
+ podsjson.write();
+
+ // verify by reading it back in a new PodsJson
+ var newPodsJson = new PodsJson(fixturePodsJson);
+ expect(newPodsJson.get('Foo')).toBeTruthy();
+ expect(newPodsJson.get('Bar')).toBeTruthy();
+ expect(newPodsJson.get('Baz')).toBeTruthy();
+
+ function podEqual (a, b) {
+ return (
+ a.name === b.name &&
+ a.type === b.type &&
+ a.spec === b.spec &&
+ a.count === b.count
+ );
+ }
+
+ expect(podEqual(podsjson.get('Foo'), newPodsJson.get('Foo'))).toBe(true);
+ expect(podEqual(podsjson.get('Bar'), newPodsJson.get('Bar'))).toBe(true);
+ expect(podEqual(podsjson.get('Baz'), newPodsJson.get('Baz'))).toBe(true);
+ });
+
+ });
+
+ it('Test 008 : tear down', function () {
+ podsjson.destroy();
+ });
});
-
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/83435d56/tests/spec/unit/build.spec.js
----------------------------------------------------------------------
diff --git a/tests/spec/unit/build.spec.js b/tests/spec/unit/build.spec.js
index 7d04966..6cf005c 100644
--- a/tests/spec/unit/build.spec.js
+++ b/tests/spec/unit/build.spec.js
@@ -24,12 +24,12 @@ var build = rewire('../../../bin/templates/scripts/cordova/lib/build');
describe('build', function () {
var testProjectPath = path.join('/test', 'project', 'path');
- describe('getXcodeBuildArgs method', function() {
+ describe('getXcodeBuildArgs method', function () {
var getXcodeBuildArgs = build.__get__('getXcodeBuildArgs');
build.__set__('__dirname', path.join('/test', 'dir'));
- it('should generate appropriate args if a single buildFlag is passed in', function(done) {
+ it('should generate appropriate args if a single buildFlag is passed in', function (done) {
var isDevice = true;
var buildFlags = '-xcconfig TestXcconfigFlag';
@@ -53,7 +53,7 @@ describe('build', function () {
done();
});
- it('should generate appropriate args if buildFlags are passed in', function(done) {
+ it('should generate appropriate args if buildFlags are passed in', function (done) {
var isDevice = true;
var buildFlags = [
'-xcconfig TestXcconfigFlag',
@@ -86,7 +86,7 @@ describe('build', function () {
done();
});
- it('should generate appropriate args for device', function(done) {
+ it('should generate appropriate args for device', function (done) {
var isDevice = true;
var args = getXcodeBuildArgs('TestProjectName', testProjectPath, 'TestConfiguration', isDevice, null);
expect(args[0]).toEqual('-xcconfig');
@@ -108,7 +108,7 @@ describe('build', function () {
done();
});
- it('should generate appropriate args for simulator', function(done) {
+ it('should generate appropriate args for simulator', function (done) {
var isDevice = false;
var args = getXcodeBuildArgs('TestProjectName', testProjectPath, 'TestConfiguration', isDevice, null, 'iPhone 5s');
expect(args[0]).toEqual('-xcconfig');
@@ -130,7 +130,7 @@ describe('build', function () {
done();
});
- it('should add matched flags that are not overriding for device', function(done) {
+ it('should add matched flags that are not overriding for device', function (done) {
var isDevice = true;
var buildFlags = '-sdk TestSdkFlag';
@@ -156,7 +156,7 @@ describe('build', function () {
done();
});
- it('should add matched flags that are not overriding for simulator', function(done) {
+ it('should add matched flags that are not overriding for simulator', function (done) {
var isDevice = false;
var buildFlags = '-archivePath TestArchivePathFlag';
@@ -183,11 +183,11 @@ describe('build', function () {
});
});
- describe('getXcodeArchiveArgs method', function() {
+ describe('getXcodeArchiveArgs method', function () {
var getXcodeArchiveArgs = build.__get__('getXcodeArchiveArgs');
- it('should generate the appropriate arguments', function(done) {
+ it('should generate the appropriate arguments', function (done) {
var archiveArgs = getXcodeArchiveArgs('TestProjectName', testProjectPath, '/test/output/path', '/test/export/options/path');
expect(archiveArgs[0]).toEqual('-exportArchive');
expect(archiveArgs[1]).toEqual('-archivePath');
@@ -201,11 +201,11 @@ describe('build', function () {
});
});
- describe('parseBuildFlag method', function() {
+ describe('parseBuildFlag method', function () {
var parseBuildFlag = build.__get__('parseBuildFlag');
- it('should detect an xcconfig change', function(done) {
+ it('should detect an xcconfig change', function (done) {
var buildFlag = '-xcconfig /path/to/config';
var args = { 'otherFlags': [] };
parseBuildFlag(buildFlag, args);
@@ -213,7 +213,7 @@ describe('build', function () {
expect(args.otherFlags.length).toEqual(0);
done();
});
- it('should detect a workspace change', function(done) {
+ it('should detect a workspace change', function (done) {
var buildFlag = '-workspace MyTestWorkspace';
var args = { 'otherFlags': [] };
parseBuildFlag(buildFlag, args);
@@ -221,7 +221,7 @@ describe('build', function () {
expect(args.otherFlags.length).toEqual(0);
done();
});
- it('should detect a scheme change', function(done) {
+ it('should detect a scheme change', function (done) {
var buildFlag = '-scheme MyTestScheme';
var args = { 'otherFlags': [] };
parseBuildFlag(buildFlag, args);
@@ -229,7 +229,7 @@ describe('build', function () {
expect(args.otherFlags.length).toEqual(0);
done();
});
- it('should detect a configuration change', function(done) {
+ it('should detect a configuration change', function (done) {
var buildFlag = '-configuration MyTestConfiguration';
var args = { 'otherFlags': [] };
parseBuildFlag(buildFlag, args);
@@ -237,7 +237,7 @@ describe('build', function () {
expect(args.otherFlags.length).toEqual(0);
done();
});
- it('should detect an sdk change', function(done) {
+ it('should detect an sdk change', function (done) {
var buildFlag = '-sdk NotARealSDK';
var args = { 'otherFlags': [] };
parseBuildFlag(buildFlag, args);
@@ -245,7 +245,7 @@ describe('build', function () {
expect(args.otherFlags.length).toEqual(0);
done();
});
- it('should detect a destination change', function(done) {
+ it('should detect a destination change', function (done) {
var buildFlag = '-destination MyTestDestination';
var args = { 'otherFlags': [] };
parseBuildFlag(buildFlag, args);
@@ -253,7 +253,7 @@ describe('build', function () {
expect(args.otherFlags.length).toEqual(0);
done();
});
- it('should detect an archivePath change', function(done) {
+ it('should detect an archivePath change', function (done) {
var buildFlag = '-archivePath MyTestArchivePath';
var args = { 'otherFlags': [] };
parseBuildFlag(buildFlag, args);
@@ -261,7 +261,7 @@ describe('build', function () {
expect(args.otherFlags.length).toEqual(0);
done();
});
- it('should detect a configuration_build_dir change', function(done) {
+ it('should detect a configuration_build_dir change', function (done) {
var buildFlag = 'CONFIGURATION_BUILD_DIR=/path/to/fake/config/build/dir';
var args = { 'otherFlags': [] };
parseBuildFlag(buildFlag, args);
@@ -269,7 +269,7 @@ describe('build', function () {
expect(args.otherFlags.length).toEqual(0);
done();
});
- it('should detect a shared_precomps_dir change', function(done) {
+ it('should detect a shared_precomps_dir change', function (done) {
var buildFlag = 'SHARED_PRECOMPS_DIR=/path/to/fake/shared/precomps/dir';
var args = { 'otherFlags': [] };
parseBuildFlag(buildFlag, args);
@@ -277,7 +277,7 @@ describe('build', function () {
expect(args.otherFlags.length).toEqual(0);
done();
});
- it('should parse arbitrary build settings', function(done) {
+ it('should parse arbitrary build settings', function (done) {
var buildFlag = 'MY_ARBITRARY_BUILD_SETTING=ValueOfArbitraryBuildSetting';
var args = { 'otherFlags': [] };
parseBuildFlag(buildFlag, args);
@@ -285,7 +285,7 @@ describe('build', function () {
expect(args.otherFlags.length).toEqual(1);
done();
});
- it('should parse userdefaults', function(done) {
+ it('should parse userdefaults', function (done) {
var buildFlag = '-myuserdefault=TestUserDefaultValue';
var args = { 'otherFlags': [] };
parseBuildFlag(buildFlag, args);
@@ -293,7 +293,7 @@ describe('build', function () {
expect(args.otherFlags.length).toEqual(1);
done();
});
- it('should parse settings with a space', function(done) {
+ it('should parse settings with a space', function (done) {
var buildFlag = '-anotherxcodebuildsetting withASpace';
var args = { 'otherFlags': [] };
parseBuildFlag(buildFlag, args);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org