You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by st...@apache.org on 2017/01/18 01:56:43 UTC
[26/50] [abbrv] cordova-lib git commit: fixjasmine : CB-12018 : fixed
jasmine tests to work with uninstallPlugin and removed waitsFor/runs,
updated promise syntax, calls.reset, and labled tests
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b33e222d/cordova-lib/spec-plugman/platforms/android.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/platforms/android.spec.js b/cordova-lib/spec-plugman/platforms/android.spec.js
index b8699a4..59710e6 100644
--- a/cordova-lib/spec-plugman/platforms/android.spec.js
+++ b/cordova-lib/spec-plugman/platforms/android.spec.js
@@ -49,12 +49,12 @@ function copyArray(arr) {
describe('android project handler', function() {
describe('www_dir method', function() {
- it('should return cordova-android project www location using www_dir', function() {
+ it('Test 001 : should return cordova-android project www location using www_dir', function() {
expect(android.www_dir(path.sep)).toEqual(path.sep + path.join('assets', 'www'));
});
});
describe('package_name method', function() {
- it('should return an android project\'s proper package name', function() {
+ it('Test 002 : should return an android project\'s proper package name', function() {
expect(android.package_name(path.join(android_one_project, '..'))).toEqual('com.alunny.childapp');
});
});
@@ -67,7 +67,7 @@ describe('android project handler', function() {
shell.rm('-rf', temp);
});
describe('of <lib-file> elements', function() {
- it('should copy jar files to project/libs', function () {
+ it('Test 003 : should copy jar files to project/libs', function () {
var s = spyOn(common, 'copyFile');
android['lib-file'].install(valid_libs[0], dummyplugin, temp);
@@ -75,7 +75,7 @@ describe('android project handler', function() {
});
});
describe('of <resource-file> elements', function() {
- it('should copy files', function () {
+ it('Test 004 : should copy files', function () {
var s = spyOn(common, 'copyFile');
android['resource-file'].install(valid_resources[0], dummyplugin, temp);
@@ -87,19 +87,20 @@ describe('android project handler', function() {
shell.cp('-rf', android_one_project, temp);
});
- it('should copy stuff from one location to another by calling common.copyFile', function() {
+ it('Test 005 : should copy stuff from one location to another by calling common.copyFile', function() {
var source = copyArray(valid_source);
var s = spyOn(common, 'copyFile');
android['source-file'].install(source[0], dummyplugin, temp);
expect(s).toHaveBeenCalledWith(dummyplugin, 'src/android/DummyPlugin.java', temp, path.join('src', 'com', 'phonegap', 'plugins', 'dummyplugin', 'DummyPlugin.java'), false);
});
- it('should throw if source file cannot be found', function() {
+ it('Test 006 : should throw if source file cannot be found', function() {
var source = copyArray(invalid_source);
expect(function() {
android['source-file'].install(source[0], faultyplugin, temp);
- }).toThrow('"' + path.resolve(faultyplugin, 'src/android/NotHere.java') + '" not found!');
+ //expect(parser.parse(raw)).toThrow(new Error("Parsing is not possible"));
+ }).toThrow(new Error('"' + path.resolve(faultyplugin, 'src/android/NotHere.java') + '" not found!'));
});
- it('should throw if target file already exists', function() {
+ it('Test 007 : should throw if target file already exists', function() {
// write out a file
var target = path.resolve(temp, 'src/com/phonegap/plugins/dummyplugin');
shell.mkdir('-p', target);
@@ -109,7 +110,7 @@ describe('android project handler', function() {
var source = copyArray(valid_source);
expect(function() {
android['source-file'].install(source[0], dummyplugin, temp);
- }).toThrow('"' + target + '" already exists!');
+ }).toThrow(new Error('"' + target + '" already exists!'));
});
});
});
@@ -122,7 +123,7 @@ describe('android project handler', function() {
shell.rm('-rf', temp);
android.purgeProjectFileCache(temp);
});
- it('with custom=true', function() {
+ it('Test 008 : with custom=true', function() {
var packageIdSuffix = 'childapp';
var frameworkElement = { src: 'plugin-lib', custom: true };
var mainProjectPropsFile = path.resolve(temp, 'project.properties');
@@ -149,7 +150,7 @@ describe('android project handler', function() {
expect(finalProjectProperties).not.toMatch('\nandroid.library.reference.3='+dummy_id+'/'+packageIdSuffix+'-plugin-lib', 'Reference to library not added');
expect(fs.existsSync(subDir)).toBe(false, 'Should delete subdir');
});
- it('with custom=true type=gradleReference', function() {
+ it('Test 009 : with custom=true type=gradleReference', function() {
var packageIdSuffix = 'childapp';
var frameworkElement = { src: 'extra.gradle', custom: true, type: 'gradleReference'};
var mainProjectPropsFile = path.resolve(temp, 'project.properties');
@@ -170,7 +171,7 @@ describe('android project handler', function() {
expect(finalProjectProperties).not.toMatch('\ncordova.gradle.include.1='+dummy_id+'/'+packageIdSuffix+'-extra.gradle', 'Reference to gradle not added');
expect(fs.existsSync(subDir)).toBe(false, 'Should delete subdir');
});
- it('with custom=false pre 4.0', function() {
+ it('Test 010 : with custom=false pre 4.0', function() {
var packageIdSuffix = 'childapp';
var frameworkElement = { src: 'extras/android/support/v4', custom: false};
var mainProjectPropsFile = path.resolve(temp, 'project.properties');
@@ -193,7 +194,7 @@ describe('android project handler', function() {
finalProjectProperties = fs.readFileSync(mainProjectPropsFile, 'utf8');
expect(finalProjectProperties).not.toMatch('\ncordova.gradle.include.1='+dummy_id+'/'+packageIdSuffix+'-extra.gradle', 'Reference to gradle not added');
});
- it('with custom=false post 4.0', function() {
+ it('Test 011 : with custom=false post 4.0', function() {
var frameworkElement = { src: 'extras/android/support/v4', custom: false};
var mainProjectPropsFile = path.resolve(temp, 'project.properties');
fs.writeFileSync(path.join(temp, 'local.properties'), 'sdk.dir=' + path.join(temp, '..', 'SDK'));
@@ -213,7 +214,7 @@ describe('android project handler', function() {
finalProjectProperties = fs.readFileSync(mainProjectPropsFile, 'utf8');
expect(finalProjectProperties).not.toMatch('\ncordova.system.library.1=' + 'extras/android/support/v4', 'Sublibrary not added');
});
- it('with custom=true and parent', function () {
+ it('Test 012 : with custom=true and parent', function () {
var packageIdSuffix = 'childapp';
var frameworkElement = { src: 'plugin-lib', custom: true };
var frameworkElementChild = { src: 'plugin-lib2', custom: true, parent: 'plugin-lib' };
@@ -247,7 +248,7 @@ describe('android project handler', function() {
expect(fs.existsSync(subDir)).toBe(false, 'Should delete subdir');
});
- it('with custom=false and parent', function () {
+ it('Test 013 : with custom=false and parent', function () {
var packageIdSuffix = 'childapp';
var frameworkElement = { src: 'plugin-lib', custom: true };
var frameworkElementChild = { src: 'extras/android/support/v4', custom: false, parent: 'plugin-lib' };
@@ -263,7 +264,7 @@ describe('android project handler', function() {
android.parseProjectFile(temp).write();
android.parseProjectFile(parentDir).write();
- exec.reset();
+ exec.calls.reset();
var finalProjectProperties = fs.readFileSync(parentProjectPropsFile, 'utf8');
var libReference = '\nandroid.library.reference.1=' + path.join('..', '..', sdkLibRelativeDir).replace(/\\/g, '/');
@@ -294,16 +295,16 @@ describe('android project handler', function() {
afterEach(function() {
shell.rm('-rf', temp);
});
- describe('of <lib-file> elements', function(done) {
- it('should remove jar files', function () {
+ describe('of <lib-file> elements', function() {
+ it('Test 014 : should remove jar files', function () {
var s = spyOn(common, 'removeFile');
android['lib-file'].install(valid_libs[0], dummyplugin, temp);
android['lib-file'].uninstall(valid_libs[0], temp, dummy_id);
expect(s).toHaveBeenCalledWith(temp, path.join('libs', 'TestLib.jar'));
});
});
- describe('of <resource-file> elements', function(done) {
- it('should remove files', function () {
+ describe('of <resource-file> elements', function() {
+ it('Test 015 : should remove files', function () {
var s = spyOn(common, 'removeFile');
android['resource-file'].install(valid_resources[0], dummyplugin, temp);
android['resource-file'].uninstall(valid_resources[0], temp, dummy_id);
@@ -311,7 +312,7 @@ describe('android project handler', function() {
});
});
describe('of <source-file> elements', function() {
- it('should remove stuff by calling common.deleteJava', function() {
+ it('Test 016 : should remove stuff by calling common.deleteJava', function() {
var s = spyOn(common, 'deleteJava');
android['source-file'].install(valid_source[0], dummyplugin, temp, dummy_id);
var source = copyArray(valid_source);
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b33e222d/cordova-lib/spec-plugman/platforms/blackberry10.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/platforms/blackberry10.spec.js b/cordova-lib/spec-plugman/platforms/blackberry10.spec.js
index 60712aa..e1afa7c 100644
--- a/cordova-lib/spec-plugman/platforms/blackberry10.spec.js
+++ b/cordova-lib/spec-plugman/platforms/blackberry10.spec.js
@@ -40,13 +40,13 @@ function copyArray(arr) {
describe('blackberry10 project handler', function() {
describe('www_dir method', function() {
- it('should return cordova-blackberry10 project www location using www_dir', function() {
+ it('Test 001 : should return cordova-blackberry10 project www location using www_dir', function() {
expect(blackberry10.www_dir(path.sep)).toEqual(path.sep + 'www');
});
});
describe('package_name method', function() {
- it('should return a blackberry10 project\'s proper package name', function() {
+ it('Test 002 : should return a blackberry10 project\'s proper package name', function() {
expect(blackberry10.package_name(path.join(blackberry10_project, '..'))).toEqual('cordovaExample');
});
});
@@ -60,7 +60,7 @@ describe('blackberry10 project handler', function() {
shell.rm('-rf', temp);
});
describe('of <lib-file> elements', function() {
- it('should copy so files to native/target/plugins', function () {
+ it('Test 003 : should copy so files to native/target/plugins', function () {
var plugin = plugins.echo,
libs = copyArray(plugin.getLibFiles('blackberry10')),
s = spyOn(common, 'copyFile');
@@ -70,7 +70,7 @@ describe('blackberry10 project handler', function() {
});
});
describe('of <source-file> elements', function() {
- it('should copy stuff from one location to another by calling common.copyFile', function() {
+ it('Test 004 : should copy stuff from one location to another by calling common.copyFile', function() {
var plugin = plugins.echo,
source = copyArray(plugin.getSourceFiles('blackberry10')),
s = spyOn(common, 'copyFile');
@@ -79,20 +79,20 @@ describe('blackberry10 project handler', function() {
expect(s).toHaveBeenCalledWith(plugin.dir, 'src/blackberry10/index.js', temp, path.join('native', 'device', 'chrome', 'plugin', 'com.cordova.echo', 'index.js'), false);
expect(s).toHaveBeenCalledWith(plugin.dir, 'src/blackberry10/index.js', temp, path.join('native', 'simulator', 'chrome', 'plugin', 'com.cordova.echo', 'index.js'), false);
});
- it('defaults to plugin id when dest is not present', function() {
+ it('Test 005 : defaults to plugin id when dest is not present', function() {
var source = copyArray(plugins.dummy.getSourceFiles('blackberry10'));
var s = spyOn(common, 'copyFile');
blackberry10['source-file'].install(source[0], plugins.dummy.dir, temp, plugins.dummy.id);
expect(s).toHaveBeenCalledWith(plugins.dummy.dir, 'src/blackberry10/index.js', temp, path.join('native', 'device', 'chrome', 'plugin', plugins.dummy.id, 'index.js'), false);
expect(s).toHaveBeenCalledWith(plugins.dummy.dir, 'src/blackberry10/index.js', temp, path.join('native', 'simulator', 'chrome', 'plugin', plugins.dummy.id, 'index.js'), false);
});
- it('should throw if source file cannot be found', function() {
+ it('Test 006 : should throw if source file cannot be found', function() {
var source = copyArray(plugins.faulty.getSourceFiles('blackberry10'));
expect(function() {
blackberry10['source-file'].install(source[0], plugins.faulty.dir, temp, plugins.faulty.id);
- }).toThrow('"' + path.resolve(plugins.faulty.dir, 'src/blackberry10/index.js') + '" not found!');
+ }).toThrow(new Error ('"' + path.resolve(plugins.faulty.dir, 'src/blackberry10/index.js') + '" not found!'));
});
- it('should throw if target file already exists', function() {
+ it('Test 007 : should throw if target file already exists', function() {
// write out a file
var target = path.resolve(temp, 'native/device/chrome/plugin/org.test.plugins.dummyplugin');
shell.mkdir('-p', target);
@@ -102,7 +102,7 @@ describe('blackberry10 project handler', function() {
var source = copyArray(plugins.dummy.getSourceFiles('blackberry10'));
expect(function() {
blackberry10['source-file'].install(source[0], plugins.dummy.dir, temp, plugins.dummy.id);
- }).toThrow('"' + target + '" already exists!');
+ }).toThrow(new Error ('"' + target + '" already exists!'));
});
});
});
@@ -116,7 +116,7 @@ describe('blackberry10 project handler', function() {
shell.rm('-rf', temp);
});
describe('of <source-file> elements', function() {
- it('should remove stuff by calling common.removeFile', function() {
+ it('Test 008 : should remove stuff by calling common.removeFile', function() {
var s = spyOn(common, 'removeFile'),
plugin = plugins.echo;
var source = copyArray(plugin.getSourceFiles('blackberry10'));
@@ -125,7 +125,7 @@ describe('blackberry10 project handler', function() {
expect(s).toHaveBeenCalledWith(temp, path.join('native', 'device', 'chrome', 'plugin', 'com.cordova.echo', 'index.js'));
expect(s).toHaveBeenCalledWith(temp, path.join('native', 'simulator', 'chrome', 'plugin', 'com.cordova.echo', 'index.js'));
});
- it('should remove stuff by calling common.removeFile', function() {
+ it('Test 009 : should remove stuff by calling common.removeFile', function() {
var s = spyOn(common, 'removeFile'),
plugin = plugins.dummy;
var source = copyArray(plugin.getSourceFiles('blackberry10'));
@@ -135,8 +135,8 @@ describe('blackberry10 project handler', function() {
expect(s).toHaveBeenCalledWith(temp, path.join('native', 'simulator', 'chrome', 'plugin', plugin.id, 'index.js'));
});
});
- describe('of <lib-file> elements', function(done) {
- it('should remove so files from www/plugins', function () {
+ describe('of <lib-file> elements', function() {
+ it('Test 010 : should remove so files from www/plugins', function () {
var s = spyOn(common, 'removeFile'),
plugin = plugins.echo;
var source = copyArray(plugin.getLibFiles('blackberry10'));
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b33e222d/cordova-lib/spec-plugman/platforms/common.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/platforms/common.spec.js b/cordova-lib/spec-plugman/platforms/common.spec.js
index 216c597..a83198b 100644
--- a/cordova-lib/spec-plugman/platforms/common.spec.js
+++ b/cordova-lib/spec-plugman/platforms/common.spec.js
@@ -36,7 +36,7 @@ var common = require('../../src/plugman/platforms/common')
describe('common platform handler', function() {
describe('resolveSrcPath', function() {
- it('should not throw if path exists', function(){
+ it('Test 001 : should not throw if path exists', function(){
shell.mkdir('-p', test_dir);
var target = path.join(test_dir, 'somefile');
fs.writeFileSync(target, '80085', 'utf-8');
@@ -46,24 +46,24 @@ describe('common platform handler', function() {
});
describe('resolveTargetPath', function() {
- it('should throw if path exists', function(){
+ it('Test 002 : should throw if path exists', function(){
shell.mkdir('-p', test_dir);
expect(function(){common.resolveTargetPath(test_dir);}).toThrow();
shell.rm('-rf', test_dir);
});
- it('should not throw if path cannot be resolved', function(){
+ it('Test 003 : should not throw if path cannot be resolved', function(){
expect(function(){common.resolveTargetPath(test_dir, 'somefile');}).not.toThrow();
});
});
describe('copyFile', function() {
- it('should throw if source path not found', function(){
+ it('Test 004 : should throw if source path not found', function(){
expect(function(){common.copyFile(test_dir, src, project_dir, dest);}).
toThrow(new Error('"' + src + '" not found!'));
});
- it('should throw if src not in plugin directory', function(){
+ it('Test 005 : should throw if src not in plugin directory', function(){
shell.mkdir('-p', project_dir);
fs.writeFileSync(non_plugin_file, 'contents', 'utf-8');
expect(function(){common.copyFile(test_dir, '../non_plugin_file', project_dir, dest);}).
@@ -71,7 +71,7 @@ describe('common platform handler', function() {
shell.rm('-rf', test_dir);
});
- it('should allow symlink src, if inside plugin', function(){
+ it('Test 006 : should allow symlink src, if inside plugin', function(){
shell.mkdir('-p', java_dir);
fs.writeFileSync(java_file, 'contents', 'utf-8');
@@ -84,7 +84,7 @@ describe('common platform handler', function() {
shell.rm('-rf', project_dir);
});
- it('should deeply symlink directory tree when src is a directory', function(){
+ it('Test 007 : should deeply symlink directory tree when src is a directory', function(){
var symlink_dir_relative_subdir = path.dirname(symlink_dir_relative_file);
shell.mkdir('-p', path.join(symlink_dir, symlink_dir_relative_subdir));
@@ -102,7 +102,7 @@ describe('common platform handler', function() {
shell.rm('-rf', project_dir);
});
- it('should throw if symlink is linked to a file outside the plugin', function(){
+ it('Test 008 : should throw if symlink is linked to a file outside the plugin', function(){
shell.mkdir('-p', java_dir);
fs.writeFileSync(non_plugin_file, 'contents', 'utf-8');
@@ -116,7 +116,7 @@ describe('common platform handler', function() {
shell.rm('-rf', project_dir);
});
- it('should throw if dest is outside the project directory', function(){
+ it('Test 009 : should throw if dest is outside the project directory', function(){
shell.mkdir('-p', java_dir);
fs.writeFileSync(java_file, 'contents', 'utf-8');
expect(function(){common.copyFile(test_dir, java_file, project_dir, non_plugin_file);}).
@@ -124,11 +124,11 @@ describe('common platform handler', function() {
shell.rm('-rf', project_dir);
});
- it('should call mkdir -p on target path', function(){
+ it('Test 010 : should call mkdir -p on target path', function(){
shell.mkdir('-p', java_dir);
fs.writeFileSync(java_file, 'contents', 'utf-8');
- var s = spyOn(shell, 'mkdir').andCallThrough();
+ var s = spyOn(shell, 'mkdir').and.callThrough();
var resolvedDest = common.resolveTargetPath(project_dir, dest);
common.copyFile(test_dir, java_file, project_dir, dest);
@@ -138,11 +138,11 @@ describe('common platform handler', function() {
shell.rm('-rf', project_dir);
});
- it('should call cp source/dest paths', function(){
+ it('Test 011 : should call cp source/dest paths', function(){
shell.mkdir('-p', java_dir);
fs.writeFileSync(java_file, 'contents', 'utf-8');
- var s = spyOn(shell, 'cp').andCallThrough();
+ var s = spyOn(shell, 'cp').and.callThrough();
var resolvedDest = common.resolveTargetPath(project_dir, dest);
common.copyFile(test_dir, java_file, project_dir, dest);
@@ -156,7 +156,7 @@ describe('common platform handler', function() {
});
describe('copyNewFile', function () {
- it('should throw if target path exists', function(){
+ it('Test 012 : should throw if target path exists', function(){
shell.mkdir('-p', dest);
expect(function(){common.copyNewFile(test_dir, src, project_dir, dest);}).
toThrow(new Error('"' + dest + '" already exists!'));
@@ -166,11 +166,11 @@ describe('common platform handler', function() {
});
describe('deleteJava', function() {
- it('should call fs.unlinkSync on the provided paths', function(){
+ it('Test 013 : should call fs.unlinkSync on the provided paths', function(){
shell.mkdir('-p', java_dir);
fs.writeFileSync(java_file, 'contents', 'utf-8');
- var s = spyOn(fs, 'unlinkSync').andCallThrough();
+ var s = spyOn(fs, 'unlinkSync').and.callThrough();
common.deleteJava(project_dir, java_file);
expect(s).toHaveBeenCalled();
expect(s).toHaveBeenCalledWith(path.resolve(project_dir, java_file));
@@ -178,7 +178,7 @@ describe('common platform handler', function() {
shell.rm('-rf', java_dir);
});
- it('should delete empty directories after removing source code in a java src path hierarchy', function(){
+ it('Test 014 : should delete empty directories after removing source code in a java src path hierarchy', function(){
shell.mkdir('-p', java_dir);
fs.writeFileSync(java_file, 'contents', 'utf-8');
@@ -190,7 +190,7 @@ describe('common platform handler', function() {
shell.rm('-rf', java_dir);
});
- it('should never delete the top-level src directory, even if all plugins added were removed', function(){
+ it('Test 015 : should never delete the top-level src directory, even if all plugins added were removed', function(){
shell.mkdir('-p', java_dir);
fs.writeFileSync(java_file, 'contents', 'utf-8');
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b33e222d/cordova-lib/spec-plugman/platforms/ios.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/platforms/ios.spec.js b/cordova-lib/spec-plugman/platforms/ios.spec.js
index b1ead60..6407069 100644
--- a/cordova-lib/spec-plugman/platforms/ios.spec.js
+++ b/cordova-lib/spec-plugman/platforms/ios.spec.js
@@ -82,40 +82,40 @@ describe('ios project handler', function() {
});
describe('www_dir method', function() {
- it('should return cordova-ios project www location using www_dir', function() {
+ it('Test 001 : should return cordova-ios project www location using www_dir', function() {
expect(ios.www_dir(path.sep)).toEqual(path.sep + 'www');
});
});
describe('package_name method', function() {
- it('should return the CFBundleIdentifier from the project\'s Info.plist file', function() {
+ it('Test 002 : should return the CFBundleIdentifier from the project\'s Info.plist file', function() {
expect(ios.package_name(ios_project)).toEqual('com.example.friendstring');
});
});
describe('parseProjectFile method', function () {
- it('should throw if project is not an xcode project', function() {
+ it('Test 003 : should throw if project is not an xcode project', function() {
expect(function() {
ios.parseProjectFile(temp);
- }).toThrow('does not appear to be an xcode project (no xcode project file)');
+ }).toThrow(new Error ('does not appear to be an xcode project (no xcode project file)'));
});
- it('should throw if project does not contain an appropriate config.xml file', function() {
+ it('Test 004 : should throw if project does not contain an appropriate config.xml file', function() {
shell.cp('-rf', ios_config_xml_project, temp);
shell.rm(path.join(temp, 'SampleApp', 'config.xml'));
expect(function() {
ios.parseProjectFile(temp);
- }).toThrow('could not find -Info.plist file, or config.xml file.');
+ }).toThrow(new Error ('could not find -Info.plist file, or config.xml file.'));
});
- it('should throw if project does not contain an appropriate -Info.plist file', function() {
+ it('Test 005 : should throw if project does not contain an appropriate -Info.plist file', function() {
shell.cp('-rf', ios_config_xml_project, temp);
shell.rm(path.join(temp, 'SampleApp', 'SampleApp-Info.plist'));
expect(function () {
ios.parseProjectFile(temp);
- }).toThrow('could not find -Info.plist file, or config.xml file.');
+ }).toThrow(new Error ('could not find -Info.plist file, or config.xml file.'));
});
- it('should return right directory when multiple .plist files are present', function() {
+ it('Test 006 : should return right directory when multiple .plist files are present', function() {
shell.cp('-rf', ios_config_xml_project, temp);
//Create a folder named A with config.xml and .plist files in it
var pathToFolderA = path.join(temp, 'A');
@@ -144,13 +144,13 @@ describe('ios project handler', function() {
});
describe('of <source-file> elements', function() {
- it('should throw if source-file src cannot be found', function() {
+ it('Test 006 : should throw if source-file src cannot be found', function() {
var source = copyArray(invalid_source);
expect(function() {
ios['source-file'].install(source[1], faultyplugin, temp, faulty_id, null, proj_files);
}).toThrow();
});
- it('should throw if source-file target already exists', function() {
+ it('Test 007 : 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));
@@ -159,13 +159,13 @@ describe('ios project handler', function() {
ios['source-file'].install(source[0], dummyplugin, temp, dummy_id, null, proj_files);
}).toThrow();
});
- it('should call into xcodeproj\'s addSourceFile appropriately when element has no target-dir', function() {
+ it('Test 008 : 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; });
var spy = spyOn(proj_files.xcode, 'addSourceFile');
ios['source-file'].install(source[0], dummyplugin, temp, dummy_id, null, proj_files);
expect(spy).toHaveBeenCalledWith(slashJoin('Plugins', dummy_id, 'DummyPluginCommand.m'), {});
});
- it('should call into xcodeproj\'s addSourceFile appropriately when element has a target-dir', function() {
+ it('Test 009 : 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; });
var spy = spyOn(proj_files.xcode, 'addSourceFile');
ios['source-file'].install(source[0], dummyplugin, temp, dummy_id, null, proj_files);
@@ -177,13 +177,13 @@ describe('ios project handler', function() {
ios['source-file'].install(source[0], dummyplugin, temp, dummy_id, null, proj_files);
expect(spy).toHaveBeenCalledWith('-f', path.join(dummyplugin, 'src', 'ios', 'DummyPluginCommand.m'), path.join(temp, 'SampleApp', 'Plugins', dummy_id, 'DummyPluginCommand.m'));
});
- it('should cp the file to the right target location when element has a target-dir', function() {
+ it('Test 010 : 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');
ios['source-file'].install(source[0], dummyplugin, temp, dummy_id, null, proj_files);
expect(spy).toHaveBeenCalledWith('-f', path.join(dummyplugin, 'src', 'ios', 'TargetDirTest.m'), path.join(temp, 'SampleApp', 'Plugins', dummy_id, 'targetDir', 'TargetDirTest.m'));
});
- it('should call into xcodeproj\'s addFramework appropriately when element has framework=true set', function() {
+ it('Test 011 : 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(proj_files.xcode, 'addSourceFile');
var spy = spyOn(proj_files.xcode, 'addFramework');
@@ -193,13 +193,13 @@ describe('ios project handler', function() {
});
describe('of <header-file> elements', function() {
- it('should throw if header-file src cannot be found', function() {
+ it('Test 012 : should throw if header-file src cannot be found', function() {
var headers = copyArray(invalid_headers);
expect(function() {
ios['header-file'].install(headers[1], faultyplugin, temp, faulty_id, null, proj_files);
}).toThrow();
});
- it('should throw if header-file target already exists', function() {
+ it('Test 013 : 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));
@@ -208,25 +208,25 @@ describe('ios project handler', function() {
ios['header-file'].install(headers[0], dummyplugin, temp, dummy_id, null, proj_files);
}).toThrow();
});
- it('should call into xcodeproj\'s addHeaderFile appropriately when element has no target-dir', function() {
+ it('Test 014 : 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; });
var spy = spyOn(proj_files.xcode, 'addHeaderFile');
ios['header-file'].install(headers[0], dummyplugin, temp, dummy_id, null, proj_files);
expect(spy).toHaveBeenCalledWith(slashJoin('Plugins', dummy_id, 'DummyPluginCommand.h'));
});
- it('should call into xcodeproj\'s addHeaderFile appropriately when element a target-dir', function() {
+ it('Test 015 : 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; });
var spy = spyOn(proj_files.xcode, 'addHeaderFile');
ios['header-file'].install(headers[0], dummyplugin, temp, dummy_id, null, proj_files);
expect(spy).toHaveBeenCalledWith(slashJoin('Plugins', dummy_id, 'targetDir', 'TargetDirTest.h'));
});
- it('should cp the file to the right target location when element has no target-dir', function() {
+ it('Test 016 : 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');
ios['header-file'].install(headers[0], dummyplugin, temp, dummy_id, null, proj_files);
expect(spy).toHaveBeenCalledWith('-f', path.join(dummyplugin, 'src', 'ios', 'DummyPluginCommand.h'), path.join(temp, 'SampleApp', 'Plugins', dummy_id, 'DummyPluginCommand.h'));
});
- it('should cp the file to the right target location when element has a target-dir', function() {
+ it('Test 017 : 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');
ios['header-file'].install(headers[0], dummyplugin, temp, dummy_id, null, proj_files);
@@ -235,28 +235,28 @@ describe('ios project handler', function() {
});
describe('of <resource-file> elements', function() {
- it('should throw if resource-file src cannot be found', function() {
+ it('Test 018 : should throw if resource-file src cannot be found', function() {
var resources = copyArray(invalid_resources);
expect(function() {
ios['resource-file'].install(resources[0], faultyplugin, temp, 'pluginid', null, proj_files);
- }).toThrow('cannot find "' + path.resolve(faultyplugin, 'src/ios/IDontExist.bundle') + '" ios <resource-file>');
+ }).toThrow(new Error ('cannot find "' + path.resolve(faultyplugin, 'src/ios/IDontExist.bundle') + '" ios <resource-file>'));
});
- it('should throw if resource-file target already exists', function() {
+ it('Test 019 : 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() {
ios['resource-file'].install(resources[0], dummyplugin, temp, 'pluginid',null, proj_files);
- }).toThrow('target destination "' + target + '" already exists');
+ }).toThrow(new Error ('target destination "' + target + '" already exists'));
});
- it('should call into xcodeproj\'s addResourceFile', function() {
+ it('Test 020 : should call into xcodeproj\'s addResourceFile', function() {
var resources = copyArray(valid_resources);
var spy = spyOn(proj_files.xcode, 'addResourceFile');
ios['resource-file'].install(resources[0], dummyplugin, temp, 'pluginid', null, proj_files);
expect(spy).toHaveBeenCalledWith(path.join('Resources', 'DummyPlugin.bundle'));
});
- it('should cp the file to the right target location', function() {
+ it('Test 021 : should cp the file to the right target location', function() {
var resources = copyArray(valid_resources);
var spy = spyOn(shell, 'cp');
ios['resource-file'].install(resources[0], dummyplugin, temp, 'pluginid', null, proj_files);
@@ -265,7 +265,7 @@ describe('ios project handler', function() {
});
describe('of <framework> elements', function() {
- it('should call into xcodeproj\'s addFramework', function() {
+ it('Test 022 : should call into xcodeproj\'s addFramework', function() {
var frameworks = copyArray(valid_custom_frameworks);
var spy = spyOn(proj_files.xcode, 'addFramework');
ios['framework'].install(frameworks[0], dummyplugin, temp, dummy_id, null, proj_files);
@@ -277,21 +277,21 @@ describe('ios project handler', function() {
// * framework that shouldn't be added/removed
describe('with custom="true" attribute', function () {
- it('should throw if framework src cannot be found', function() {
+ it('Test 023 : should throw if framework src cannot be found', function() {
var frameworks = copyArray(invalid_custom_frameworks);
expect(function() {
ios['framework'].install(frameworks[0], faultyplugin, temp, dummy_id, null, proj_files);
- }).toThrow('cannot find "' + path.resolve(faultyplugin, 'src/ios/NonExistantCustomFramework.framework') + '" ios <framework>');
+ }).toThrow(new Error ('cannot find "' + path.resolve(faultyplugin, 'src/ios/NonExistantCustomFramework.framework') + '" ios <framework>'));
});
- it('should throw if framework target already exists', function() {
+ it('Test 024 : 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() {
ios['framework'].install(frameworks[0], dummyplugin, temp, dummy_id, null, proj_files);
- }).toThrow('target destination "' + target + '" already exists');
+ }).toThrow(new Error ('target destination "' + target + '" already exists'));
});
- it('should cp the file to the right target location', function() {
+ it('Test 025 : should cp the file to the right target location', function() {
var frameworks = copyArray(valid_custom_frameworks);
var spy = spyOn(shell, 'cp');
ios['framework'].install(frameworks[0], dummyplugin, temp, dummy_id, null, proj_files);
@@ -300,15 +300,19 @@ describe('ios project handler', function() {
});
});
});
- it('of two plugins should apply xcode file changes from both', function(){
- runs(function() {
- installPromise(
- install('ios', temp, dummyplugin)
- .then(function () { install('ios', temp, weblessplugin); })
- );
- });
- waitsFor(function() { return done; }, 'install promise never resolved', 200);
- runs(function() {
+ it('Test 026 : of two plugins should apply xcode file changes from both', function(done){
+ return install('ios', temp, weblessplugin)
+ .then(function (result) {
+ var xcode = ios.parseProjectFile(temp).xcode;
+ // from org.test.plugins.weblessplugin
+ expect(xcode.hasFile(slashJoin('Resources', 'WeblessPluginViewController.xib'))).toBeTruthy();
+ expect(xcode.hasFile(slashJoin('Plugins','org.test.plugins.weblessplugin','WeblessPluginCommand.h'))).toBeTruthy();
+ expect(xcode.hasFile(slashJoin('Plugins','org.test.plugins.weblessplugin','WeblessPluginCommand.m'))).toBeTruthy();
+ expect(xcode.hasFile('usr/lib/libsqlite3.dylib')).toBeTruthy();
+ done();
+ }).then(function () {
+ return install('ios', temp, dummyplugin)
+ }).then(function () {
var xcode = ios.parseProjectFile(temp).xcode;
// from org.test.plugins.dummyplugin
expect(xcode.hasFile(slashJoin('Resources', 'DummyPlugin.bundle'))).toBeTruthy();
@@ -317,32 +321,28 @@ describe('ios project handler', function() {
expect(xcode.hasFile(slashJoin('Plugins','org.test.plugins.dummyplugin','targetDir','TargetDirTest.h'))).toBeTruthy();
expect(xcode.hasFile(slashJoin('Plugins','org.test.plugins.dummyplugin','targetDir','TargetDirTest.m'))).toBeTruthy();
expect(xcode.hasFile(slashJoin('SampleApp','Plugins','org.test.plugins.dummyplugin','Custom.framework'))).toBeTruthy();
- // from org.test.plugins.weblessplugin
- expect(xcode.hasFile(slashJoin('Resources', 'WeblessPluginViewController.xib'))).toBeTruthy();
- expect(xcode.hasFile(slashJoin('Plugins','org.test.plugins.weblessplugin','WeblessPluginCommand.h'))).toBeTruthy();
- expect(xcode.hasFile(slashJoin('Plugins','org.test.plugins.weblessplugin','WeblessPluginCommand.m'))).toBeTruthy();
- expect(xcode.hasFile('usr/lib/libsqlite3.dylib')).toBeTruthy();
+ done();
});
- });
+ }, 60000);
});
describe('uninstallation', function() {
describe('of <source-file> elements', function() {
- it('should call into xcodeproj\'s removeSourceFile appropriately when element has no target-dir', function(){
+ it('Test 027 : 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; });
shell.cp('-rf', ios_config_xml_project, temp);
var spy = spyOn(proj_files.xcode, 'removeSourceFile');
ios['source-file'].uninstall(source[0], temp, dummy_id, null, proj_files);
expect(spy).toHaveBeenCalledWith(slashJoin('Plugins', dummy_id, 'DummyPluginCommand.m'));
});
- it('should call into xcodeproj\'s removeSourceFile appropriately when element a target-dir', function(){
+ it('Test 028 : 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; });
shell.cp('-rf', ios_config_xml_project, temp);
var spy = spyOn(proj_files.xcode, 'removeSourceFile');
ios['source-file'].uninstall(source[0], temp, dummy_id, null, proj_files);
expect(spy).toHaveBeenCalledWith(slashJoin('Plugins', dummy_id, 'targetDir', 'TargetDirTest.m'));
});
- it('should rm the file from the right target location when element has no target-dir', function(){
+ it('Test 029 : 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; });
shell.cp('-rf', ios_config_xml_project, temp);
@@ -350,7 +350,7 @@ describe('ios project handler', function() {
ios['source-file'].uninstall(source[0], temp, dummy_id, null, proj_files);
expect(spy).toHaveBeenCalledWith('-rf', path.join(temp, 'SampleApp', 'Plugins', dummy_id));
});
- it('should rm the file from the right target location when element has a target-dir', function(){
+ it('Test 030 : 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; });
shell.cp('-rf', ios_config_xml_project, temp);
var spy = spyOn(shell, 'rm');
@@ -358,7 +358,7 @@ describe('ios project handler', function() {
ios['source-file'].uninstall(source[0], temp, dummy_id, null, proj_files);
expect(spy).toHaveBeenCalledWith('-rf', path.join(temp, 'SampleApp', 'Plugins', dummy_id, 'targetDir'));
});
- it('should call into xcodeproj\'s removeFramework appropriately when element framework=true set', function(){
+ it('Test 031 : should call into xcodeproj\'s removeFramework appropriately when element framework=true set', function(){
var source = copyArray(valid_source).filter(function(s) { return s.framework; });
shell.cp('-rf', ios_config_xml_project, temp);
var spy = spyOn(proj_files.xcode, 'removeFramework');
@@ -372,14 +372,14 @@ describe('ios project handler', function() {
beforeEach(function() {
shell.cp('-rf', ios_config_xml_project, temp);
});
- it('should call into xcodeproj\'s removeHeaderFile appropriately when element has no target-dir', function(){
+ it('Test 032 : 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; });
var spy = spyOn(proj_files.xcode, 'removeHeaderFile');
ios['header-file'].uninstall(headers[0], temp, dummy_id, null, proj_files);
expect(spy).toHaveBeenCalledWith(slashJoin('Plugins', dummy_id, 'DummyPluginCommand.h'));
});
- it('should call into xcodeproj\'s removeHeaderFile appropriately when element a target-dir', function(){
+ it('Test 033 : 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; });
var spy = spyOn(proj_files.xcode, 'removeHeaderFile');
@@ -387,7 +387,7 @@ describe('ios project handler', function() {
ios['header-file'].uninstall(headers[0], temp, dummy_id, null, proj_files);
expect(spy).toHaveBeenCalledWith(slashJoin('Plugins', dummy_id, 'targetDir', 'TargetDirTest.h'));
});
- it('should rm the file from the right target location', function(){
+ it('Test 034 : 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');
@@ -400,14 +400,14 @@ describe('ios project handler', function() {
beforeEach(function() {
shell.cp('-rf', ios_config_xml_project, temp);
});
- it('should call into xcodeproj\'s removeResourceFile', function(){
+ it('Test 035 : should call into xcodeproj\'s removeResourceFile', function(){
var resources = copyArray(valid_resources);
var spy = spyOn(proj_files.xcode, 'removeResourceFile');
ios['resource-file'].uninstall(resources[0], temp, 'pluginid', null, proj_files);
expect(spy).toHaveBeenCalledWith(path.join('Resources', 'DummyPlugin.bundle'));
});
- it('should rm the file from the right target location', function(){
+ it('Test 036 : should rm the file from the right target location', function(){
var resources = copyArray(valid_resources);
var spy = spyOn(shell, 'rm');
@@ -420,7 +420,7 @@ describe('ios project handler', function() {
shell.cp('-rf', ios_config_xml_project, temp);
});
- it('should call into xcodeproj\'s removeFramework', function(){
+ it('Test 037 : should call into xcodeproj\'s removeFramework', function(){
var frameworks = copyArray(valid_custom_frameworks);
var spy = spyOn(proj_files.xcode, 'removeFramework');
@@ -433,7 +433,7 @@ describe('ios project handler', function() {
// * framework that shouldn't be added/removed
describe('with custom="true" attribute', function () {
- it('should rm the file from the right target location', function(){
+ it('Test 038 : should rm the file from the right target location', function(){
var frameworks = copyArray(valid_custom_frameworks);
var spy = spyOn(shell, 'rm');
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b33e222d/cordova-lib/spec-plugman/platforms/tizen.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/platforms/tizen.spec.js b/cordova-lib/spec-plugman/platforms/tizen.spec.js
index 04d2f0f..f4a5bba 100644
--- a/cordova-lib/spec-plugman/platforms/tizen.spec.js
+++ b/cordova-lib/spec-plugman/platforms/tizen.spec.js
@@ -37,13 +37,13 @@ var tizen = require('../../src/plugman/platforms/tizen'),
describe('Tizen project handler', function() {
describe('www_dir method', function() {
- it('should append www to the directory passed in', function() {
+ it('Test 001 : should append www to the directory passed in', function() {
expect(tizen.www_dir(path.sep)).toEqual(path.join(path.sep, 'www'));
});
});
describe('Manipulating project files', function() {
describe('package_name method', function() {
- it('should return the id of the config.xml root element', function() {
+ it('Test 002 : should return the id of the config.xml root element', function() {
expect(tizen.package_name(tizen_project)).toEqual('TizenTestPackage');
});
});
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org