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:46 UTC
[29/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-common/spec/PlatformJson.spec.js
----------------------------------------------------------------------
diff --git a/cordova-common/spec/PlatformJson.spec.js b/cordova-common/spec/PlatformJson.spec.js
index 293b51d..58a4533 100644
--- a/cordova-common/spec/PlatformJson.spec.js
+++ b/cordova-common/spec/PlatformJson.spec.js
@@ -30,7 +30,7 @@ var FAKE_MODULE = {
};
describe('PlatformJson class', function() {
- it('should be constructable', function () {
+ it('Test 001 : should be constructable', function () {
expect(new PlatformJson()).toEqual(jasmine.any(PlatformJson));
});
@@ -47,19 +47,19 @@ describe('PlatformJson class', function() {
});
describe('addPluginMetadata method', function () {
- it('should not throw if root "modules" property is missing', function () {
+ it('Test 002 : should not throw if root "modules" property is missing', function () {
expect(function () {
platformJson.addPluginMetadata(fakePlugin);
}).not.toThrow();
});
- it('should add each module to "root.modules" array', function () {
+ it('Test 003 : should add each module to "root.modules" array', function () {
platformJson.addPluginMetadata(fakePlugin);
expect(platformJson.root.modules.length).toBe(1);
expect(platformJson.root.modules[0]).toEqual(jasmine.any(ModuleMetadata));
});
- it('shouldn\'t add module if there is already module with the same file added', function () {
+ it('Test 004 : shouldn\'t add module if there is already module with the same file added', function () {
platformJson.root.modules = [{
name: 'fakePlugin2',
file: 'plugins/fakeId/www/fakeModule.js'
@@ -70,20 +70,20 @@ describe('PlatformJson class', function() {
expect(platformJson.root.modules[0].name).toBe('fakePlugin2');
});
- it('should add entry to plugin_metadata with corresponding version', function () {
+ it('Test 005 : should add entry to plugin_metadata with corresponding version', function () {
platformJson.addPluginMetadata(fakePlugin);
expect(platformJson.root.plugin_metadata[fakePlugin.id]).toBe(fakePlugin.version);
});
});
describe('removePluginMetadata method', function () {
- it('should not throw if root "modules" property is missing', function () {
+ it('Test 006 : should not throw if root "modules" property is missing', function () {
expect(function () {
platformJson.removePluginMetadata(fakePlugin);
}).not.toThrow();
});
- it('should remove plugin modules from "root.modules" array based on file path', function () {
+ it('Test 007 : should remove plugin modules from "root.modules" array based on file path', function () {
var pluginPaths = [
'plugins/fakeId/www/fakeModule.js',
@@ -100,7 +100,7 @@ describe('PlatformJson class', function() {
expect(resultantPaths.length).toBe(0);
});
- it('should remove entry from plugin_metadata with corresponding version', function () {
+ it('Test 008 : should remove entry from plugin_metadata with corresponding version', function () {
platformJson.root.plugin_metadata = {};
platformJson.root.plugin_metadata[fakePlugin.id] = fakePlugin.version;
platformJson.removePluginMetadata(fakePlugin);
@@ -109,7 +109,7 @@ describe('PlatformJson class', function() {
});
describe('generateMetadata method', function () {
- it('should generate text metadata containing list of installed modules', function () {
+ it('Test 009 : should generate text metadata containing list of installed modules', function () {
var meta = platformJson.addPluginMetadata(fakePlugin).generateMetadata();
expect(typeof meta).toBe('string');
expect(meta.indexOf(JSON.stringify(platformJson.root.modules, null, 4))).toBeGreaterThan(0);
@@ -121,7 +121,7 @@ describe('PlatformJson class', function() {
});
describe('ModuleMetadata class', function () {
- it('should be constructable', function () {
+ it('Test 010 : should be constructable', function () {
var meta;
expect(function name(params) {
meta = new ModuleMetadata('fakePlugin', {src: 'www/fakeModule.js'});
@@ -129,31 +129,31 @@ describe('ModuleMetadata class', function () {
expect(meta instanceof ModuleMetadata).toBeTruthy();
});
- it('should throw if either pluginId or jsModule argument isn\'t specified', function () {
+ it('Test 011 : should throw if either pluginId or jsModule argument isn\'t specified', function () {
expect(ModuleMetadata).toThrow();
expect(function () { new ModuleMetadata('fakePlugin', {}); }).toThrow();
});
- it('should guess module id either from name property of from module src', function () {
+ it('Test 012 : should guess module id either from name property of from module src', function () {
expect(new ModuleMetadata('fakePlugin', {name: 'fakeModule'}).id).toMatch(/fakeModule$/);
expect(new ModuleMetadata('fakePlugin', {src: 'www/fakeModule.js'}).id).toMatch(/fakeModule$/);
});
- it('should read "clobbers" property from module', function () {
+ it('Test 013 : should read "clobbers" property from module', function () {
expect(new ModuleMetadata('fakePlugin', {name: 'fakeModule'}).clobbers).not.toBeDefined();
var metadata = new ModuleMetadata('fakePlugin', FAKE_MODULE);
expect(metadata.clobbers).toEqual(jasmine.any(Array));
expect(metadata.clobbers[0]).toBe(FAKE_MODULE.clobbers[0].target);
});
- it('should read "merges" property from module', function () {
+ it('Test 014 : should read "merges" property from module', function () {
expect(new ModuleMetadata('fakePlugin', {name: 'fakeModule'}).merges).not.toBeDefined();
var metadata = new ModuleMetadata('fakePlugin', FAKE_MODULE);
expect(metadata.merges).toEqual(jasmine.any(Array));
expect(metadata.merges[0]).toBe(FAKE_MODULE.merges[0].target);
});
- it('should read "runs" property from module', function () {
+ it('Test 015 : should read "runs" property from module', function () {
expect(new ModuleMetadata('fakePlugin', {name: 'fakeModule'}).runs).not.toBeDefined();
expect(new ModuleMetadata('fakePlugin', FAKE_MODULE).runs).toBe(true);
});
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b33e222d/cordova-common/spec/PluginInfo/PluginInfo.spec.js
----------------------------------------------------------------------
diff --git a/cordova-common/spec/PluginInfo/PluginInfo.spec.js b/cordova-common/spec/PluginInfo/PluginInfo.spec.js
index 935d8cd..e509913 100644
--- a/cordova-common/spec/PluginInfo/PluginInfo.spec.js
+++ b/cordova-common/spec/PluginInfo/PluginInfo.spec.js
@@ -23,7 +23,7 @@ var PluginInfo = require('../../src/PluginInfo/PluginInfo'),
var pluginsDir = path.join(__dirname, '../fixtures/plugins');
describe('PluginInfo', function () {
- it('should read a plugin.xml file', function () {
+ it('Test 001 : should read a plugin.xml file', function () {
var p, prefs, assets, deps, configFiles, infos, srcFiles;
var headerFiles, libFiles, resourceFiles;
expect(function () {
@@ -42,7 +42,7 @@ describe('PluginInfo', function () {
expect(p.name).toEqual('Child Browser');
// TODO: Add some expectations for results of getSomething.
});
- it('should throw when there is no plugin.xml file', function () {
+ it('Test 002 : should throw when there is no plugin.xml file', function () {
expect(function () {
new PluginInfo('/non/existent/dir');
}).toThrow();
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b33e222d/cordova-common/spec/PluginInfo/PluginInfoProvider.spec.js
----------------------------------------------------------------------
diff --git a/cordova-common/spec/PluginInfo/PluginInfoProvider.spec.js b/cordova-common/spec/PluginInfo/PluginInfoProvider.spec.js
index 40ec6bb..9c86501 100644
--- a/cordova-common/spec/PluginInfo/PluginInfoProvider.spec.js
+++ b/cordova-common/spec/PluginInfo/PluginInfoProvider.spec.js
@@ -24,7 +24,7 @@ var pluginsDir = path.join(__dirname, '../fixtures/plugins');
describe('PluginInfoProvider', function () {
describe('getAllWithinSearchPath', function () {
- it('should load all plugins in a dir', function () {
+ it('Test 001 : should load all plugins in a dir', function () {
var pluginInfoProvider = new PluginInfoProvider();
var plugins = pluginInfoProvider.getAllWithinSearchPath(pluginsDir);
expect(plugins.length).not.toBe(0);
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b33e222d/cordova-common/spec/PluginManager.spec.js
----------------------------------------------------------------------
diff --git a/cordova-common/spec/PluginManager.spec.js b/cordova-common/spec/PluginManager.spec.js
index cba7c79..7f6d7e8 100644
--- a/cordova-common/spec/PluginManager.spec.js
+++ b/cordova-common/spec/PluginManager.spec.js
@@ -17,7 +17,8 @@
under the License.
*/
-require ('promise-matchers');
+// Promise-matchers do not work with jasmine 2.0.
+//require('promise-matchers');
var Q = require('q');
var fs = require('fs');
@@ -44,11 +45,11 @@ describe('PluginManager class', function() {
spyOn(shell, 'mkdir');
});
- it('should be constructable', function () {
+ it('Test 001 : should be constructable', function () {
expect(new PluginManager(FAKE_PLATFORM, FAKE_LOCATIONS)).toEqual(jasmine.any(PluginManager));
});
- it('should return new instance for every PluginManager.get call', function () {
+ it('Test 002 : should return new instance for every PluginManager.get call', function () {
expect(PluginManager.get(FAKE_PLATFORM, FAKE_LOCATIONS)).toEqual(jasmine.any(PluginManager));
expect(PluginManager.get(FAKE_PLATFORM, FAKE_LOCATIONS))
.not.toBe(PluginManager.get(FAKE_PLATFORM, FAKE_LOCATIONS));
@@ -64,7 +65,7 @@ describe('PluginManager class', function() {
FAKE_PROJECT = jasmine.createSpyObj('project', ['getInstaller', 'getUninstaller', 'write']);
manager = new PluginManager('windows', FAKE_LOCATIONS, FAKE_PROJECT);
actions = jasmine.createSpyObj('actions', ['createAction', 'push', 'process']);
- actions.process.andReturn(Q.resolve());
+ actions.process.and.returnValue(Q.resolve());
PluginManager.__set__('ActionStack', function () { return actions; });
});
@@ -76,20 +77,20 @@ describe('PluginManager class', function() {
it('should return a promise', function () {
expect(Q.isPromise(manager.addPlugin(null, {}))).toBe(true);
});
-
- it('should reject if "plugin" parameter is not specified or not a PluginInfo instance', function () {
- expect(manager.addPlugin(null, {})).toHaveBeenRejected();
- expect(manager.addPlugin({}, {})).toHaveBeenRejected();
- expect(manager.addPlugin(new PluginInfo(DUMMY_PLUGIN), {})).not.toHaveBeenRejected();
+ // Promise-matchers do not work with jasmine 2.0.
+ xit('Test 003 : should reject if "plugin" parameter is not specified or not a PluginInfo instance', function (done) {
+ expect(manager.addPlugin(null, {})).toHaveBeenRejected(done);
+ expect(manager.addPlugin({}, {})).toHaveBeenRejected(done);
+ expect(manager.addPlugin(new PluginInfo(DUMMY_PLUGIN), {})).not.toHaveBeenRejected(done);
});
- it('should iterate through all plugin\'s files and frameworks', function (done) {
+ it('Test 004 : should iterate through all plugin\'s files and frameworks', function (done) {
manager.addPlugin(new PluginInfo(DUMMY_PLUGIN), {})
.then(function () {
- expect(FAKE_PROJECT.getInstaller.calls.length).toBe(16);
- expect(FAKE_PROJECT.getUninstaller.calls.length).toBe(16);
+ expect(FAKE_PROJECT.getInstaller.calls.count()).toBe(16);
+ expect(FAKE_PROJECT.getUninstaller.calls.count()).toBe(16);
- expect(actions.push.calls.length).toBe(16);
+ expect(actions.push.calls.count()).toBe(16);
expect(actions.process).toHaveBeenCalled();
expect(FAKE_PROJECT.write).toHaveBeenCalled();
})
@@ -100,7 +101,7 @@ describe('PluginManager class', function() {
});
});
- it('should save plugin metadata to www directory', function (done) {
+ it('Test 005 : should save plugin metadata to www directory', function (done) {
var metadataPath = path.join(manager.locations.www, 'cordova_plugins.js');
var platformWwwMetadataPath = path.join(manager.locations.platformWww, 'cordova_plugins.js');
@@ -116,7 +117,7 @@ describe('PluginManager class', function() {
});
});
- it('should save plugin metadata to both www ans platform_www directories when options.usePlatformWww is specified', function (done) {
+ it('Test 006 : should save plugin metadata to both www ans platform_www directories when options.usePlatformWww is specified', function (done) {
var metadataPath = path.join(manager.locations.www, 'cordova_plugins.js');
var platformWwwMetadataPath = path.join(manager.locations.platformWww, 'cordova_plugins.js');
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b33e222d/cordova-common/spec/events.spec.js
----------------------------------------------------------------------
diff --git a/cordova-common/spec/events.spec.js b/cordova-common/spec/events.spec.js
index a9e7f43..863664c 100644
--- a/cordova-common/spec/events.spec.js
+++ b/cordova-common/spec/events.spec.js
@@ -23,13 +23,13 @@ describe('forwardEventsTo method', function () {
afterEach(function() {
events.forwardEventsTo(null);
});
- it('should not go to infinite loop when trying to forward to self', function () {
+ it('Test 001 : should not go to infinite loop when trying to forward to self', function () {
expect(function() {
events.forwardEventsTo(events);
events.emit('log', 'test message');
}).not.toThrow();
});
- it('should reset forwarding after trying to forward to self', function () {
+ it('Test 002 : should reset forwarding after trying to forward to self', function () {
var EventEmitter = require('events').EventEmitter;
var anotherEventEmitter = new EventEmitter();
var logSpy = jasmine.createSpy('logSpy');
@@ -39,7 +39,7 @@ describe('forwardEventsTo method', function () {
events.emit('log', 'test message #1');
expect(logSpy).toHaveBeenCalled();
- logSpy.reset();
+ logSpy.calls.reset();
events.forwardEventsTo(events);
events.emit('log', 'test message #2');
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b33e222d/cordova-common/spec/superspawn.spec.js
----------------------------------------------------------------------
diff --git a/cordova-common/spec/superspawn.spec.js b/cordova-common/spec/superspawn.spec.js
index 2539199..73a85d9 100644
--- a/cordova-common/spec/superspawn.spec.js
+++ b/cordova-common/spec/superspawn.spec.js
@@ -30,12 +30,12 @@ describe('spawn method', function() {
failSpy = jasmine.createSpy('fail');
});
- it('should return a promise', function () {
+ it('Test 001 : should return a promise', function () {
expect(Q.isPromise(superspawn.spawn(LS))).toBe(true);
expect(Q.isPromise(superspawn.spawn('invalid_command'))).toBe(true);
});
- it('should notify about stdout "data" events', function (done) {
+ it('Test 002 : should notify about stdout "data" events', function (done) {
superspawn.spawn(LS, [], {stdio: 'pipe'})
.progress(progressSpy)
.fin(function () {
@@ -44,7 +44,7 @@ describe('spawn method', function() {
});
});
- it('should notify about stderr "data" events', function (done) {
+ it('Test 003 : should notify about stderr "data" events', function (done) {
superspawn.spawn(LS, ['doesnt-exist'], {stdio: 'pipe'})
.progress(progressSpy)
.fin(function () {
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b33e222d/cordova-common/spec/util/xml-helpers.spec.js
----------------------------------------------------------------------
diff --git a/cordova-common/spec/util/xml-helpers.spec.js b/cordova-common/spec/util/xml-helpers.spec.js
index 0becf72..916e9af 100644
--- a/cordova-common/spec/util/xml-helpers.spec.js
+++ b/cordova-common/spec/util/xml-helpers.spec.js
@@ -54,7 +54,7 @@ var TEST_XML = '<?xml version="1.0" encoding="UTF-8"?>\n' +
describe('xml-helpers', function(){
describe('parseElementtreeSync', function() {
- it('should parse xml with a byte order mark', function() {
+ it('Test 001 : should parse xml with a byte order mark', function() {
var xml_path = path.join(__dirname, '../fixtures/projects/windows/bom_test.xml');
expect(function() {
xml_helpers.parseElementtreeSync(xml_path);
@@ -62,35 +62,35 @@ describe('xml-helpers', function(){
});
});
describe('equalNodes', function() {
- it('should return false for different tags', function(){
+ it('Test 002 : should return false for different tags', function(){
expect(xml_helpers.equalNodes(usesNetworkOne, title)).toBe(false);
});
- it('should return true for identical tags', function(){
+ it('Test 003 : should return true for identical tags', function(){
expect(xml_helpers.equalNodes(usesNetworkOne, usesNetworkTwo)).toBe(true);
});
- it('should return false for different attributes', function(){
+ it('Test 004 : should return false for different attributes', function(){
expect(xml_helpers.equalNodes(usesNetworkOne, usesReceive)).toBe(false);
});
- it('should distinguish between text', function(){
+ it('Test 005 : should distinguish between text', function(){
expect(xml_helpers.equalNodes(helloTagOne, goodbyeTag)).toBe(false);
});
- it('should ignore whitespace in text', function(){
+ it('Test 006 : should ignore whitespace in text', function(){
expect(xml_helpers.equalNodes(helloTagOne, helloTagTwo)).toBe(true);
});
describe('should compare children', function(){
- it('by child quantity', function(){
+ it('Test 007: by child quantity', function(){
var one = et.XML('<i><b>o</b></i>'),
two = et.XML('<i><b>o</b><u></u></i>');
expect(xml_helpers.equalNodes(one, two)).toBe(false);
});
- it('by child equality', function(){
+ it('Test 008 : by child equality', function(){
var one = et.XML('<i><b>o</b></i>'),
two = et.XML('<i><u></u></i>'),
uno = et.XML('<i>\n<b>o</b>\n</i>');
@@ -107,22 +107,22 @@ describe('xml-helpers', function(){
config_xml = xml_helpers.parseElementtreeSync(path.join(__dirname, '../fixtures/projects/android/res/xml/config.xml'));
});
- it('should remove any children that match the specified selector', function() {
+ it('Test 009 : should remove any children that match the specified selector', function() {
var children = config_xml.findall('plugins/plugin');
xml_helpers.pruneXML(config_xml, children, 'plugins');
expect(config_xml.find('plugins').getchildren().length).toEqual(0);
});
- it('should do nothing if the children cannot be found', function() {
+ it('Test 010 : should do nothing if the children cannot be found', function() {
var children = [title];
xml_helpers.pruneXML(config_xml, children, 'plugins');
expect(config_xml.find('plugins').getchildren().length).toEqual(17);
});
- it('should be able to handle absolute selectors', function() {
+ it('Test 011 : should be able to handle absolute selectors', function() {
var children = config_xml.findall('plugins/plugin');
xml_helpers.pruneXML(config_xml, children, '/cordova/plugins');
expect(config_xml.find('plugins').getchildren().length).toEqual(0);
});
- it('should be able to handle absolute selectors with wildcards', function() {
+ it('Test 012 : should be able to handle absolute selectors with wildcards', function() {
var children = config_xml.findall('plugins/plugin');
xml_helpers.pruneXML(config_xml, children, '/*/plugins');
expect(config_xml.find('plugins').getchildren().length).toEqual(0);
@@ -135,7 +135,7 @@ describe('xml-helpers', function(){
beforeEach(function() {
android_manifest_xml = xml_helpers.parseElementtreeSync(path.join(__dirname, '../fixtures/projects/android/AndroidManifest.xml'));
});
- it('should restore attributes at the specified selector', function() {
+ it('Test 013 : should restore attributes at the specified selector', function() {
var xml = {
oldAttrib: {'android:icon': '@drawable/icon', 'android:label': '@string/app_name', 'android:debuggable': 'false'}
};
@@ -144,7 +144,7 @@ describe('xml-helpers', function(){
expect(Object.keys(applicationAttr).length).toEqual(3);
expect(applicationAttr['android:debuggable']).toEqual('false');
});
- it('should do nothing if the old attributes cannot be found', function() {
+ it('Test 014 : should do nothing if the old attributes cannot be found', function() {
var xml = {
notOldAttrib: {'android:icon': '@drawable/icon', 'android:label': '@string/app_name', 'android:debuggable': 'false'}
};
@@ -153,7 +153,7 @@ describe('xml-helpers', function(){
expect(Object.keys(applicationAttr).length).toEqual(3);
expect(applicationAttr['android:debuggable']).toEqual('true');
});
- it('should be able to handle absolute selectors', function() {
+ it('Test 015 : should be able to handle absolute selectors', function() {
var xml = {
oldAttrib: {'android:icon': '@drawable/icon', 'android:label': '@string/app_name', 'android:debuggable': 'false'}
};
@@ -162,7 +162,7 @@ describe('xml-helpers', function(){
expect(Object.keys(applicationAttr).length).toEqual(3);
expect(applicationAttr['android:debuggable']).toEqual('false');
});
- it('should be able to handle absolute selectors with wildcards', function() {
+ it('Test 016 : should be able to handle absolute selectors with wildcards', function() {
var xml = {
oldAttrib: {'android:name': 'ChildApp', 'android:label': '@string/app_name', 'android:configChanges': 'orientation|keyboardHidden', 'android:enabled': 'true'}
};
@@ -171,7 +171,7 @@ describe('xml-helpers', function(){
expect(Object.keys(activityAttr).length).toEqual(4);
expect(activityAttr['android:enabled']).toEqual('true');
});
- it('should be able to handle xpath selectors', function() {
+ it('Test 017 : should be able to handle xpath selectors', function() {
var xml = {
oldAttrib: {'android:name': 'com.phonegap.DroidGap', 'android:label': '@string/app_name', 'android:configChanges': 'orientation|keyboardHidden', 'android:enabled': 'true'}
};
@@ -190,17 +190,17 @@ describe('xml-helpers', function(){
plugin_xml = xml_helpers.parseElementtreeSync(path.join(__dirname, '../fixtures/plugins/ChildBrowser/plugin.xml'));
});
- it('should add children to the specified selector', function() {
+ it('Test 018 : should add children to the specified selector', function() {
var children = plugin_xml.find('config-file').getchildren();
xml_helpers.graftXML(config_xml, children, 'plugins');
expect(config_xml.find('plugins').getchildren().length).toEqual(19);
});
- it('should be able to handle absolute selectors', function() {
+ it('Test 019 : should be able to handle absolute selectors', function() {
var children = plugin_xml.find('config-file').getchildren();
xml_helpers.graftXML(config_xml, children, '/cordova');
expect(config_xml.findall('access').length).toEqual(3);
});
- it('should be able to handle absolute selectors with wildcards', function() {
+ it('Test 020 : should be able to handle absolute selectors with wildcards', function() {
var children = plugin_xml.find('config-file').getchildren();
xml_helpers.graftXML(config_xml, children, '/*');
expect(config_xml.findall('access').length).toEqual(3);
@@ -214,7 +214,7 @@ describe('xml-helpers', function(){
plugin_xml = xml_helpers.parseElementtreeSync(path.join(__dirname, '../fixtures/plugins/org.test.editconfigtest/plugin.xml'));
android_manifest_xml = xml_helpers.parseElementtreeSync(path.join(__dirname, '../fixtures/projects/android/AndroidManifest.xml'));
});
- it ('should merge attributes at specified selector', function() {
+ it ('Test 021 : should merge attributes at specified selector', function() {
var children = plugin_xml.find('platform/edit-config[@mode=\"merge\"]').getchildren();
xml_helpers.graftXMLMerge(android_manifest_xml, children, 'application/activity[@android:name=\"com.phonegap.DroidGap\"]', {});
var activityAttr = android_manifest_xml.find('application/activity[@android:name=\"com.phonegap.DroidGap\"]').attrib;
@@ -222,7 +222,7 @@ describe('xml-helpers', function(){
expect(activityAttr['android:enabled']).toEqual('true');
expect(activityAttr['android:configChanges']).toEqual('keyboardHidden');
});
- it ('should be able to handle absolute selectors', function() {
+ it ('Test 022 : should be able to handle absolute selectors', function() {
var children = plugin_xml.find('platform/edit-config[@mode=\"merge\"]').getchildren();
xml_helpers.graftXMLMerge(android_manifest_xml, children, '/manifest/application/activity[@android:name=\"com.phonegap.DroidGap\"]', {});
var activityAttr = android_manifest_xml.find('application/activity[@android:name=\"com.phonegap.DroidGap\"]').attrib;
@@ -230,7 +230,7 @@ describe('xml-helpers', function(){
expect(activityAttr['android:enabled']).toEqual('true');
expect(activityAttr['android:configChanges']).toEqual('keyboardHidden');
});
- it ('should be able to handle absolute selectors with wildcards', function() {
+ it ('Test 023 : should be able to handle absolute selectors with wildcards', function() {
var children = plugin_xml.find('platform/edit-config[@mode=\"merge\"]').getchildren();
xml_helpers.graftXMLMerge(android_manifest_xml, children, '/*/*/activity[@android:name=\"com.phonegap.DroidGap\"]', {});
var activityAttr = android_manifest_xml.find('application/activity[@android:name=\"com.phonegap.DroidGap\"]').attrib;
@@ -238,7 +238,7 @@ describe('xml-helpers', function(){
expect(activityAttr['android:enabled']).toEqual('true');
expect(activityAttr['android:configChanges']).toEqual('keyboardHidden');
});
- it ('should be able to handle xpath selectors', function() {
+ it ('Test 024 : should be able to handle xpath selectors', function() {
var children = plugin_xml.find('platform/edit-config[@mode=\"merge\"]').getchildren();
xml_helpers.graftXMLMerge(android_manifest_xml, children, 'application/activity[@android:name=\"com.phonegap.DroidGap\"]', {});
var activityAttr = android_manifest_xml.find('application/activity[@android:name=\"com.phonegap.DroidGap\"]').attrib;
@@ -255,7 +255,7 @@ describe('xml-helpers', function(){
plugin_xml = xml_helpers.parseElementtreeSync(path.join(__dirname, '../fixtures/plugins/org.test.editconfigtest/plugin.xml'));
android_manifest_xml = xml_helpers.parseElementtreeSync(path.join(__dirname, '../fixtures/projects/android/AndroidManifest.xml'));
});
- it ('should overwrite attributes at specified selector', function() {
+ it ('Test 025 : should overwrite attributes at specified selector', function() {
var children = plugin_xml.find('platform/edit-config[@mode=\"overwrite\"]').getchildren();
xml_helpers.graftXMLOverwrite(android_manifest_xml, children, 'application/activity', {});
var activityAttr = android_manifest_xml.find('application/activity').attrib;
@@ -263,7 +263,7 @@ describe('xml-helpers', function(){
expect(activityAttr['android:enabled']).toEqual('true');
expect(activityAttr['android:configChanges']).not.toBeDefined();
});
- it ('should be able to handle absolute selectors', function() {
+ it ('Test 026 : should be able to handle absolute selectors', function() {
var children = plugin_xml.find('platform/edit-config[@mode=\"overwrite\"]').getchildren();
xml_helpers.graftXMLOverwrite(android_manifest_xml, children, '/manifest/application/activity', {});
var activityAttr = android_manifest_xml.find('application/activity').attrib;
@@ -271,7 +271,7 @@ describe('xml-helpers', function(){
expect(activityAttr['android:enabled']).toEqual('true');
expect(activityAttr['android:configChanges']).not.toBeDefined();
});
- it ('should be able to handle absolute selectors with wildcards', function() {
+ it ('Test 027 : should be able to handle absolute selectors with wildcards', function() {
var children = plugin_xml.find('platform/edit-config[@mode=\"overwrite\"]').getchildren();
xml_helpers.graftXMLOverwrite(android_manifest_xml, children, '/*/*/activity', {});
var activityAttr = android_manifest_xml.find('application/activity').attrib;
@@ -279,7 +279,7 @@ describe('xml-helpers', function(){
expect(activityAttr['android:enabled']).toEqual('true');
expect(activityAttr['android:configChanges']).not.toBeDefined();
});
- it ('should be able to handle xpath selectors', function() {
+ it ('Test 028 : should be able to handle xpath selectors', function() {
var children = plugin_xml.find('platform/edit-config[@mode=\"overwrite\"]').getchildren();
xml_helpers.graftXMLOverwrite(android_manifest_xml, children, 'application/activity[@android:name=\"ChildApp\"]', {});
var activityAttr = android_manifest_xml.find('application/activity').attrib;
@@ -295,7 +295,7 @@ describe('xml-helpers', function(){
dstXml = et.XML(TEST_XML);
});
- it('should merge attributes and text of the root element without clobbering', function () {
+ it('Test 029 : should merge attributes and text of the root element without clobbering', function () {
var testXml = et.XML('<widget foo="bar" id="NOTANID">TEXT</widget>');
xml_helpers.mergeXml(testXml, dstXml);
expect(dstXml.attrib.foo).toEqual('bar');
@@ -303,7 +303,7 @@ describe('xml-helpers', function(){
expect(dstXml.text).not.toEqual('TEXT');
});
- it('should merge attributes and text of the root element with clobbering', function () {
+ it('Test 030 : should merge attributes and text of the root element with clobbering', function () {
var testXml = et.XML('<widget foo="bar" id="NOTANID">TEXT</widget>');
xml_helpers.mergeXml(testXml, dstXml, 'foo', true);
expect(dstXml.attrib.foo).toEqual('bar');
@@ -311,7 +311,7 @@ describe('xml-helpers', function(){
expect(dstXml.text).toEqual('TEXT');
});
- it('should handle attributes values with quotes correctly', function () {
+ it('Test 031 : should handle attributes values with quotes correctly', function () {
var testXml = et.XML('<widget><quote foo="some \'quoted\' string" bar="another "quoted" string" baz=""mixed" \'quotes\'" /></widget>');
xml_helpers.mergeXml(testXml, dstXml);
expect(dstXml.find('quote')).toBeDefined();
@@ -320,7 +320,7 @@ describe('xml-helpers', function(){
expect(dstXml.find('quote').attrib.baz).toEqual('"mixed" \'quotes\'');
});
- it('should not merge platform tags with the wrong platform', function () {
+ it('Test 032 : should not merge platform tags with the wrong platform', function () {
var testXml = et.XML('<widget><platform name="bar"><testElement testAttrib="value">testTEXT</testElement></platform></widget>'),
origCfg = et.tostring(dstXml);
@@ -328,7 +328,7 @@ describe('xml-helpers', function(){
expect(et.tostring(dstXml)).toEqual(origCfg);
});
- it('should merge platform tags with the correct platform', function () {
+ it('Test 033 : should merge platform tags with the correct platform', function () {
var testXml = et.XML('<widget><platform name="bar"><testElement testAttrib="value">testTEXT</testElement></platform></widget>'),
origCfg = et.tostring(dstXml);
@@ -340,7 +340,7 @@ describe('xml-helpers', function(){
expect(testElement.text).toEqual('testTEXT');
});
- it('should merge singleton children without clobber', function () {
+ it('Test 034 : should merge singleton children without clobber', function () {
var testXml = et.XML('<widget><author testAttrib="value" href="http://www.nowhere.com">SUPER_AUTHOR</author></widget>');
xml_helpers.mergeXml(testXml, dstXml);
@@ -353,7 +353,7 @@ describe('xml-helpers', function(){
expect(testElements[0].text).toContain('Apache Cordova Team');
});
- it('should merge singleton name without clobber', function () {
+ it('Test 035 : should merge singleton name without clobber', function () {
var testXml = et.XML('<widget><name>SUPER_NAME</name></widget>');
xml_helpers.mergeXml(testXml, dstXml);
@@ -363,7 +363,7 @@ describe('xml-helpers', function(){
expect(testElements[0].text).toContain('Hello Cordova');
});
- it('should clobber singleton children with clobber', function () {
+ it('Test 036 : should clobber singleton children with clobber', function () {
var testXml = et.XML('<widget><author testAttrib="value" href="http://www.nowhere.com">SUPER_AUTHOR</author></widget>');
xml_helpers.mergeXml(testXml, dstXml, '', true);
@@ -376,7 +376,7 @@ describe('xml-helpers', function(){
expect(testElements[0].text).toEqual('SUPER_AUTHOR');
});
- it('should merge singleton name with clobber', function () {
+ it('Test 037 : should merge singleton name with clobber', function () {
var testXml = et.XML('<widget><name>SUPER_NAME</name></widget>');
xml_helpers.mergeXml(testXml, dstXml, '', true);
@@ -386,7 +386,7 @@ describe('xml-helpers', function(){
expect(testElements[0].text).toContain('SUPER_NAME');
});
- it('should append non singelton children', function () {
+ it('Test 038 : should append non singelton children', function () {
var testXml = et.XML('<widget><preference num="1"/> <preference num="2"/></widget>');
xml_helpers.mergeXml(testXml, dstXml, '', true);
@@ -394,7 +394,7 @@ describe('xml-helpers', function(){
expect(testElements.length).toEqual(4);
});
- it('should handle namespaced elements', function () {
+ it('Test 039 : should handle namespaced elements', function () {
var testXml = et.XML('<widget><foo:bar testAttrib="value">testText</foo:bar></widget>');
xml_helpers.mergeXml(testXml, dstXml, 'foo', true);
@@ -404,7 +404,7 @@ describe('xml-helpers', function(){
expect(testElement.text).toEqual('testText');
});
- it('should not append duplicate non singelton children', function () {
+ it('Test 040 : should not append duplicate non singelton children', function () {
var testXml = et.XML('<widget><preference name="fullscreen" value="true"/></widget>');
xml_helpers.mergeXml(testXml, dstXml, '', true);
@@ -412,7 +412,7 @@ describe('xml-helpers', function(){
expect(testElements.length).toEqual(2);
});
- it('should not skip partial duplicate non singelton children', function () {
+ it('Test 041 : should not skip partial duplicate non singelton children', function () {
//remove access tags from dstXML
var testElements = dstXml.findall('access');
for(var i = 0; i < testElements.length; i++) {
@@ -433,7 +433,7 @@ describe('xml-helpers', function(){
});
- it('should remove duplicate preferences (by name attribute value)', function () {
+ it('Test 042 : should remove duplicate preferences (by name attribute value)', function () {
var testXml = et.XML(
'<?xml version="1.0" encoding="UTF-8"?>\n' +
'<widget xmlns = "http://www.w3.org/ns/widgets"\n' +
@@ -454,7 +454,7 @@ describe('xml-helpers', function(){
expect(testElements.length).toEqual(1);
});
- it('should merge preferences, with platform preferences written last', function () {
+ it('Test 043 : should merge preferences, with platform preferences written last', function () {
var testXml = et.XML(
'<?xml version="1.0" encoding="UTF-8"?>\n' +
'<widget xmlns = "http://www.w3.org/ns/widgets"\n' +
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b33e222d/cordova-lib/spec-cordova/HooksRunner.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/HooksRunner.spec.js b/cordova-lib/spec-cordova/HooksRunner.spec.js
index 697787d..859822d 100644
--- a/cordova-lib/spec-cordova/HooksRunner.spec.js
+++ b/cordova-lib/spec-cordova/HooksRunner.spec.js
@@ -81,19 +81,19 @@ describe('HooksRunner', function() {
process.chdir(path.join(__dirname, '..')); // Non e2e tests assume CWD is repo root.
});
- it('should throw if provided directory is not a cordova project', function() {
+ it('Test 001 : should throw if provided directory is not a cordova project', function() {
expect(function() {
new HooksRunner(tmpDir);
}).toThrow();
});
- it('should not throw if provided directory is a cordova project', function() {
+ it('Test 002 : should not throw if provided directory is a cordova project', function() {
expect(function () {
new HooksRunner(project);
}).not.toThrow();
});
- it('should init test fixtures', function(done) {
+ it('Test 003 : should init test fixtures', function(done) {
hooksRunner = new HooksRunner(project);
// Now we load the config.json in the newly created project and edit the target platform's lib entry
@@ -243,7 +243,7 @@ describe('HooksRunner', function() {
}
describe('application hooks', function() {
- it('should execute hook scripts serially', function (done) {
+ it('Test 004 : should execute hook scripts serially', function (done) {
var test_event = 'before_build';
var projectRoot = cordovaUtil.isCordova();
var hooksOrderFile = path.join(projectRoot, 'hooks_order.txt');
@@ -259,7 +259,7 @@ describe('HooksRunner', function() {
});
});
- it('should execute hook scripts serially from .cordova/hooks/hook_type and hooks/hook_type directories', function (done) {
+ it('Test 005 : should execute hook scripts serially from .cordova/hooks/hook_type and hooks/hook_type directories', function (done) {
var test_event = 'before_build';
var projectRoot = cordovaUtil.isCordova();
var hooksOrderFile = path.join(projectRoot, 'hooks_order.txt');
@@ -278,7 +278,7 @@ describe('HooksRunner', function() {
});
});
- it('should execute hook scripts serially from config.xml', function (done) {
+ it('Test 006 : should execute hook scripts serially from config.xml', function (done) {
var test_event = 'before_build';
var projectRoot = cordovaUtil.isCordova();
var hooksOrderFile = path.join(projectRoot, 'hooks_order.txt');
@@ -297,7 +297,7 @@ describe('HooksRunner', function() {
});
});
- it('should execute hook scripts serially from config.xml including platform scripts', function (done) {
+ it('Test 007 : should execute hook scripts serially from config.xml including platform scripts', function (done) {
var test_event = 'before_build';
var projectRoot = cordovaUtil.isCordova();
var hooksOrderFile = path.join(projectRoot, 'hooks_order.txt');
@@ -316,7 +316,7 @@ describe('HooksRunner', function() {
});
});
- it('should filter hook scripts from config.xml by platform', function (done) {
+ it('Test 008 : should filter hook scripts from config.xml by platform', function (done) {
var test_event = 'before_build';
var projectRoot = cordovaUtil.isCordova();
var hooksOrderFile = path.join(projectRoot, 'hooks_order.txt');
@@ -345,7 +345,7 @@ describe('HooksRunner', function() {
});
describe('plugin hooks', function() {
- it('should execute hook scripts serially from plugin.xml', function (done) {
+ it('Test 009 : should execute hook scripts serially from plugin.xml', function (done) {
var test_event = 'before_build';
var projectRoot = cordovaUtil.isCordova();
var hooksOrderFile = path.join(projectRoot, 'hooks_order.txt');
@@ -364,7 +364,7 @@ describe('HooksRunner', function() {
});
});
- it('should execute hook scripts serially from plugin.xml including platform scripts', function (done) {
+ it('Test 010 : should execute hook scripts serially from plugin.xml including platform scripts', function (done) {
var test_event = 'before_build';
var projectRoot = cordovaUtil.isCordova();
var hooksOrderFile = path.join(projectRoot, 'hooks_order.txt');
@@ -383,7 +383,7 @@ describe('HooksRunner', function() {
});
});
- it('should filter hook scripts from plugin.xml by platform', function (done) {
+ it('Test 011 : should filter hook scripts from plugin.xml by platform', function (done) {
var test_event = 'before_build';
var projectRoot = cordovaUtil.isCordova();
var hooksOrderFile = path.join(projectRoot, 'hooks_order.txt');
@@ -410,7 +410,7 @@ describe('HooksRunner', function() {
});
});
- it('should run before_plugin_uninstall, before_plugin_install, after_plugin_install hooks for a plugin being installed with correct opts.plugin context', function (done) {
+ it('Test 012 : should run before_plugin_uninstall, before_plugin_install, after_plugin_install hooks for a plugin being installed with correct opts.plugin context', function (done) {
var projectRoot = cordovaUtil.isCordova();
// remove plugin
@@ -467,7 +467,7 @@ describe('HooksRunner', function() {
});
});
- it('should not execute the designated hook when --nohooks option specifies the exact hook name', function (done) {
+ it('Test 013 : should not execute the designated hook when --nohooks option specifies the exact hook name', function (done) {
var test_event = 'before_build';
hookOptions.nohooks = ['before_build'];
@@ -481,7 +481,7 @@ describe('HooksRunner', function() {
});
});
- it('should not execute a set of matched hooks when --nohooks option specifies the hook pattern.', function (done) {
+ it('Test 014 : should not execute a set of matched hooks when --nohooks option specifies the hook pattern.', function (done) {
var test_events = ['before_build', 'after_plugin_add', 'before_platform_rm', 'before_prepare'];
hookOptions.nohooks = ['before*'];
@@ -502,7 +502,7 @@ describe('HooksRunner', function() {
});
});
- it('should not execute all hooks when --nohooks option specifies .', function (done) {
+ it('Test 015 : should not execute all hooks when --nohooks option specifies .', function (done) {
var test_events = ['before_build', 'after_plugin_add', 'before_platform_rm', 'before_prepare'];
hookOptions.nohooks = ['.'];
@@ -527,10 +527,10 @@ describe('HooksRunner', function() {
afterEach(function () {
cordova.removeAllListeners(test_event);
- handler.reset();
+ handler.calls.reset();
});
- it('should fire handlers using cordova.on', function(done) {
+ it('Test 016 : should fire handlers using cordova.on', function(done) {
cordova.on(test_event, handler);
hooksRunner.fire(test_event, hookOptions).then(function () {
expect(handler).toHaveBeenCalled();
@@ -539,7 +539,7 @@ describe('HooksRunner', function() {
}).fin(done);
});
- it('should pass the project root folder as parameter into the module-level handlers', function (done) {
+ it('Test 017 : should pass the project root folder as parameter into the module-level handlers', function (done) {
cordova.on(test_event, handler);
hooksRunner.fire(test_event, hookOptions).then(function () {
expect(handler).toHaveBeenCalledWith(hookOptions);
@@ -549,7 +549,7 @@ describe('HooksRunner', function() {
}).fin(done);
});
- it('should be able to stop listening to events using cordova.off', function(done) {
+ it('Test 018 : should be able to stop listening to events using cordova.off', function(done) {
cordova.on(test_event, handler);
cordova.off(test_event, handler);
hooksRunner.fire(test_event, hookOptions).then(function () {
@@ -560,7 +560,7 @@ describe('HooksRunner', function() {
}).fin(done);
});
- it('should execute event listeners serially', function(done) {
+ it('Test 019 : should execute event listeners serially', function(done) {
var h1_fired = false;
var h1 = function() {
expect(h2_fired).toBe(false);
@@ -592,7 +592,7 @@ describe('HooksRunner', function() {
});
});
- it('should allow for hook to opt into asynchronous execution and block further hooks from firing using the done callback', function(done) {
+ it('Test 020 : should allow for hook to opt into asynchronous execution and block further hooks from firing using the done callback', function(done) {
var h1_fired = false;
var h1 = function () {
h1_fired = true;
@@ -615,7 +615,7 @@ describe('HooksRunner', function() {
});
});
- it('should pass data object that fire calls into async handlers', function(done) {
+ it('Test 021 : should pass data object that fire calls into async handlers', function(done) {
var async = function (opts) {
expect(opts).toEqual(hookOptions);
return Q();
@@ -626,7 +626,7 @@ describe('HooksRunner', function() {
});
});
- it('should pass data object that fire calls into sync handlers', function(done) {
+ it('Test 022 : should pass data object that fire calls into sync handlers', function(done) {
var async = function (opts) {
expect(opts).toEqual(hookOptions);
};
@@ -634,7 +634,7 @@ describe('HooksRunner', function() {
hooksRunner.fire(test_event, hookOptions).fin(done);
});
- it('should error if any script exits with non-zero code', function(done) {
+ it('Test 023 : should error if any script exits with non-zero code', function(done) {
hooksRunner.fire('fail', hookOptions).then(function () {
expect('the call').toBe('a failure');
}, function (err) {
@@ -643,7 +643,7 @@ describe('HooksRunner', function() {
});
});
- it('should not error if the hook is unrecognized', function(done) {
+ it('Test 024 :should not error if the hook is unrecognized', function(done) {
hooksRunner.fire('CLEAN YOUR SHORTS GODDAMNIT LIKE A BIG BOY!', hookOptions).fail(function (err) {
expect('Call with unrecognized hook ').toBe('successful.\n' + err);
}).fin(done);
@@ -651,7 +651,7 @@ describe('HooksRunner', function() {
});
// Cleanup. Must be the last spec. Is there a better place for final cleanup in Jasmine?
- it('should not fail during cleanup', function () {
+ it('Test 025 : should not fail during cleanup', function () {
process.chdir(path.join(__dirname, '..')); // Non e2e tests assume CWD is repo root.
if (ext == 'sh') {
shell.rm('-rf', tmpDir);
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b33e222d/cordova-lib/spec-cordova/build.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/build.spec.js b/cordova-lib/spec-cordova/build.spec.js
index 3f7f90e..d1fe02e 100644
--- a/cordova-lib/spec-cordova/build.spec.js
+++ b/cordova-lib/spec-cordova/build.spec.js
@@ -38,7 +38,7 @@ describe('build command', function() {
compile_spy = spyOn(cordova.raw, 'compile').and.returnValue(Q());
});
describe('failure', function() {
- it('should not run inside a project with no platforms', function(done) {
+ it('Test 001 : should not run inside a project with no platforms', function(done) {
list_platforms.and.returnValue([]);
cordova.raw.build()
.then(function() {
@@ -50,7 +50,7 @@ describe('build command', function() {
}).fin(done);
});
- it('should not run outside of a Cordova-based project', function(done) {
+ it('Test 002 : should not run outside of a Cordova-based project', function(done) {
is_cordova.and.returnValue(false);
cordova.raw.build()
@@ -65,15 +65,15 @@ describe('build command', function() {
});
describe('success', function() {
- it('should run inside a Cordova-based project with at least one added platform and call both prepare and compile', function(done) {
+ it('Test 003 : should run inside a Cordova-based project with at least one added platform and call both prepare and compile', function(done) {
cordova.raw.build(['android','ios']).then(function() {
- var opts = Object({ platforms: [ 'android', 'ios' ], verbose: false, options: Object({ }) })
+ var opts = Object({ platforms: [ 'android', 'ios' ], verbose: false, options: Object({ }) });
expect(prepare_spy).toHaveBeenCalledWith(opts);
expect(compile_spy).toHaveBeenCalledWith(opts);
done();
});
});
- it('should pass down options', function(done) {
+ it('Test 004 : should pass down options', function(done) {
cordova.raw.build({platforms: ['android'], options: {release: true}}).then(function() {
var opts = {platforms: ['android'], options: {release: true}, verbose: false};
expect(prepare_spy).toHaveBeenCalledWith(opts);
@@ -82,7 +82,7 @@ describe('build command', function() {
});
});
- it('should convert options from old format and warn user about this', function (done) {
+ it('Test 005 : should convert options from old format and warn user about this', function (done) {
function warnSpy(message) {
expect(message).toMatch('The format of cordova.raw.* methods "options" argument was changed');
}
@@ -100,22 +100,22 @@ describe('build command', function() {
describe('hooks', function() {
describe('when platforms are added', function() {
- it('should fire before hooks through the hooker module', function(done) {
+ it('Test 006 : should fire before hooks through the hooker module', function(done) {
cordova.raw.build(['android', 'ios']).then(function() {
- expect(fire).toHaveBeenCalledWith('before_build', {verbose: false, platforms:['android', 'ios'], options: []});
+ expect(fire.calls.argsFor(0)).toEqual(['before_build', {verbose: false, platforms:['android', 'ios'] , options: {}}]);
done();
});
});
- it('should fire after hooks through the hooker module', function(done) {
+ it('Test 007 : should fire after hooks through the hooker module', function(done) {
cordova.raw.build('android').then(function() {
- expect(fire).toHaveBeenCalledWith('after_build', {verbose: false, platforms:['android'], options: []});
+ expect(fire.calls.argsFor(1)).toEqual([ 'after_build', { platforms: [ 'android' ], verbose: false, options: {} } ]);
done();
});
});
});
describe('with no platforms added', function() {
- it('should not fire the hooker', function(done) {
+ it('Test 008 : should not fire the hooker', function(done) {
list_platforms.and.returnValue([]);
Q().then(cordova.raw.build).then(function() {
expect('this call').toBe('fail');
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b33e222d/cordova-lib/spec-cordova/compile.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/compile.spec.js b/cordova-lib/spec-cordova/compile.spec.js
index 4371425..4cd1c1d 100644
--- a/cordova-lib/spec-cordova/compile.spec.js
+++ b/cordova-lib/spec-cordova/compile.spec.js
@@ -39,7 +39,7 @@ describe('compile command', function() {
fail = function (err) { expect(err.stack).not.toBeDefined(); };
});
describe('failure', function() {
- it('should not run inside a Cordova-based project with no added platforms by calling util.listPlatforms', function(done) {
+ it('Test 001 : should not run inside a Cordova-based project with no added platforms by calling util.listPlatforms', function(done) {
list_platforms.and.returnValue([]);
var success = jasmine.createSpy('success');
cordova.raw.compile()
@@ -52,7 +52,7 @@ describe('compile command', function() {
done();
});
});
- it('should not run outside of a Cordova-based project', function(done) {
+ it('Test 002 : should not run outside of a Cordova-based project', function(done) {
is_cordova.and.returnValue(false);
var success = jasmine.createSpy('success');
cordova.raw.compile()
@@ -67,7 +67,7 @@ describe('compile command', function() {
});
describe('success', function() {
- it('should run inside a Cordova-based project with at least one added platform and shell out to build', function(done) {
+ it('Test 003 : should run inside a Cordova-based project with at least one added platform and shell out to build', function(done) {
cordova.raw.compile(['android','ios']).then(function() {
expect(getPlatformApi).toHaveBeenCalledWith('android');
expect(getPlatformApi).toHaveBeenCalledWith('ios');
@@ -77,7 +77,7 @@ describe('compile command', function() {
.fin(done);
});
- it('should pass down optional parameters', function (done) {
+ it('Test 004 : should pass down optional parameters', function (done) {
cordova.raw.compile({platforms:['blackberry10'], options:{release: true}}).then(function () {
expect(getPlatformApi).toHaveBeenCalledWith('blackberry10');
expect(platformApi.build).toHaveBeenCalledWith({release: true});
@@ -86,7 +86,7 @@ describe('compile command', function() {
.fin(done);
});
- it('should convert options from old format and warn user about this', function (done) {
+ it('Test 005 : should convert options from old format and warn user about this', function (done) {
function warnSpy(message) {
expect(message).toMatch('The format of cordova.raw.* methods "options" argument was changed');
}
@@ -106,18 +106,18 @@ describe('compile command', function() {
describe('hooks', function() {
describe('when platforms are added', function() {
- it('should fire before hooks through the hooker module', function(done) {
+ it('Test 006 : should fire before hooks through the hooker module', function(done) {
cordova.raw.compile(['android', 'ios']).then(function() {
- expect(fire).toHaveBeenCalledWith('before_compile', {verbose: false, platforms:['android', 'ios'], options: []});
+ expect(fire.calls.argsFor(0)).toEqual(['before_compile', {verbose: false, platforms:['android', 'ios'] , options: {}}]);
done();
})
.fail(fail)
.fin(done);
});
- it('should fire after hooks through the hooker module', function(done) {
+ it('Test 007 : should fire after hooks through the hooker module', function(done) {
cordova.raw.compile('android').then(function() {
- expect(fire).toHaveBeenCalledWith('after_compile', {verbose: false, platforms:['android'], options: []});
- done();
+ expect(fire.calls.argsFor(1)).toEqual(['after_compile', {verbose: false, platforms:['android'] , options: {}}]);
+ done();
})
.fail(fail)
.fin(done);
@@ -125,7 +125,7 @@ describe('compile command', function() {
});
describe('with no platforms added', function() {
- it('should not fire the hooker', function(done) {
+ it('Test 008 : should not fire the hooker', function(done) {
list_platforms.and.returnValue([]);
Q().then(cordova.raw.compile).then(function() {
expect('this call').toBe('fail');
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b33e222d/cordova-lib/spec-cordova/create.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/create.spec.js b/cordova-lib/spec-cordova/create.spec.js
index 2876fe6..d731ccb 100644
--- a/cordova-lib/spec-cordova/create.spec.js
+++ b/cordova-lib/spec-cordova/create.spec.js
@@ -39,7 +39,7 @@ var configBasic = {
};
describe('cordova create checks for valid-identifier', function() {
- it('should reject reserved words from start of id', function(done) {
+ it('Test 001 : should reject reserved words from start of id', function(done) {
cordova.raw.create('projectPath', 'int.bob', 'appName', {}, events)
.fail(function(err) {
expect(err.message).toBe('App id contains a reserved word, or is not a valid identifier.');
@@ -47,7 +47,7 @@ describe('cordova create checks for valid-identifier', function() {
.fin(done);
});
- it('should reject reserved words from end of id', function(done) {
+ it('Test 002 : should reject reserved words from end of id', function(done) {
cordova.raw.create('projectPath', 'bob.class', 'appName', {}, events)
.fail(function(err) {
expect(err.message).toBe('App id contains a reserved word, or is not a valid identifier.');
@@ -94,7 +94,7 @@ describe('create basic test (see more in cordova-create)', function() {
var results;
events.on('results', function(res) { results = res; });
- it('should successfully run', function(done) {
+ it('Test 003 : should successfully run', function(done) {
// Call cordova create with no args, should return help.
Q()
.then(function() {
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b33e222d/cordova-lib/spec-cordova/emulate.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/emulate.spec.js b/cordova-lib/spec-cordova/emulate.spec.js
index 7372df2..ecb6440 100644
--- a/cordova-lib/spec-cordova/emulate.spec.js
+++ b/cordova-lib/spec-cordova/emulate.spec.js
@@ -44,7 +44,7 @@ describe('emulate command', function() {
getPlatformApi = spyOn(platforms, 'getPlatformApi').and.returnValue(platformApi);
});
describe('failure', function() {
- it('should not run inside a Cordova-based project with no added platforms by calling util.listPlatforms', function(done) {
+ it('Test 001 : should not run inside a Cordova-based project with no added platforms by calling util.listPlatforms', function(done) {
list_platforms.and.returnValue([]);
var success = jasmine.createSpy('success');
cordova.raw.compile()
@@ -57,7 +57,7 @@ describe('emulate command', function() {
done();
});
});
- it('should not run outside of a Cordova-based project', function(done) {
+ it('Test 002 : should not run outside of a Cordova-based project', function(done) {
is_cordova.and.returnValue(false);
var success = jasmine.createSpy('success');
cordova.raw.compile()
@@ -72,7 +72,7 @@ describe('emulate command', function() {
});
describe('success', function() {
- it('should run inside a Cordova-based project with at least one added platform and call prepare and shell out to the emulate script', function(done) {
+ it('Test 003 : should run inside a Cordova-based project with at least one added platform and call prepare and shell out to the emulate script', function(done) {
cordova.raw.emulate(['android','ios']).then(function(err) {
expect(prepare_spy).toHaveBeenCalledWith(jasmine.objectContaining({platforms: ['android', 'ios']}));
expect(getPlatformApi).toHaveBeenCalledWith('android');
@@ -83,7 +83,7 @@ describe('emulate command', function() {
.fail(fail)
.fin(done);
});
- it('should pass down options', function(done) {
+ it('Test 004 : should pass down options', function(done) {
cordova.raw.emulate({platforms: ['ios'], options: {optionTastic: true }}).then(function(err) {
expect(prepare_spy).toHaveBeenCalledWith(jasmine.objectContaining({platforms: ['ios']}));
expect(getPlatformApi).toHaveBeenCalledWith('ios');
@@ -93,7 +93,7 @@ describe('emulate command', function() {
.fail(fail)
.fin(done);
});
- it('should convert options from old format and warn user about this', function (done) {
+ it('Test 005 : should convert options from old format and warn user about this', function (done) {
function warnSpy(message) {
expect(message).toMatch('The format of cordova.raw.* methods "options" argument was changed');
}
@@ -122,7 +122,7 @@ describe('emulate command', function() {
afterEach(function() {
platformApi.build = originalBuildSpy;
});
- it('should leave parameters unchanged', function(done) {
+ it('Test 006 : should leave parameters unchanged', function(done) {
cordova.raw.run({platforms: ['blackberry10'], options:{password: '1q1q'}}).then(function() {
expect(prepare_spy).toHaveBeenCalledWith({ platforms: [ 'blackberry10' ], options: { password: '1q1q', 'couldBeModified': 'insideBuild' }, verbose: false });
expect(platformApi.build).toHaveBeenCalledWith({password: '1q1q', 'couldBeModified': 'insideBuild'});
@@ -133,7 +133,7 @@ describe('emulate command', function() {
});
});
- it('should call platform\'s build method', function (done) {
+ it('Test 007 : should call platform\'s build method', function (done) {
cordova.raw.emulate({platforms: ['blackberry10']})
.then(function() {
expect(prepare_spy).toHaveBeenCalled();
@@ -145,7 +145,7 @@ describe('emulate command', function() {
.fin(done);
});
- it('should not call build if --nobuild option is passed', function (done) {
+ it('Test 008 : should not call build if --nobuild option is passed', function (done) {
cordova.raw.emulate({platforms: ['blackberry10'], options: { nobuild: true }})
.then(function() {
expect(prepare_spy).toHaveBeenCalled();
@@ -160,7 +160,7 @@ describe('emulate command', function() {
describe('hooks', function() {
describe('when platforms are added', function() {
- it('should fire before hooks through the hooker module', function(done) {
+ it('Test 009 : should fire before hooks through the hooker module', function(done) {
cordova.raw.emulate(['android', 'ios']).then(function() {
expect(fire).toHaveBeenCalledWith('before_emulate',
jasmine.objectContaining({verbose: false, platforms:['android', 'ios'], options: jasmine.any(Object)}));
@@ -168,7 +168,7 @@ describe('emulate command', function() {
.fail(fail)
.fin(done);
});
- it('should fire after hooks through the hooker module', function(done) {
+ it('Test 010 : should fire after hooks through the hooker module', function(done) {
cordova.raw.emulate('android').then(function() {
expect(fire).toHaveBeenCalledWith('after_emulate',
jasmine.objectContaining({verbose: false, platforms:['android'], options: jasmine.any(Object)}));
@@ -179,7 +179,7 @@ describe('emulate command', function() {
});
describe('with no platforms added', function() {
- it('should not fire the hooker', function(done) {
+ it('Test 011 : should not fire the hooker', function(done) {
list_platforms.and.returnValue([]);
Q().then(cordova.raw.emulate).then(function() {
expect('this call').toBe('fail');
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b33e222d/cordova-lib/spec-cordova/helpers.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/helpers.js b/cordova-lib/spec-cordova/helpers.js
index e77078a..76686df 100644
--- a/cordova-lib/spec-cordova/helpers.js
+++ b/cordova-lib/spec-cordova/helpers.js
@@ -157,14 +157,14 @@ beforeEach(function () {
result.pass = fs.existsSync(actual);
if(result.pass) {
- result.message = "expected " + actual + " to not exist";
+ result.message = 'expected ' + actual + ' to not exist';
} else {
- result.message = "expected " + actual + " to exist";
+ result.message = 'expected ' + actual + ' to exist';
}
return result;
}
- }
+ };
}
});
});
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b33e222d/cordova-lib/spec-cordova/lazy_load.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/lazy_load.spec.js b/cordova-lib/spec-cordova/lazy_load.spec.js
index e421cc8..dc0f816 100644
--- a/cordova-lib/spec-cordova/lazy_load.spec.js
+++ b/cordova-lib/spec-cordova/lazy_load.spec.js
@@ -55,14 +55,14 @@ describe('lazy_load module', function() {
afterEach(function () {
platforms.android.version = version;
});
- it('should throw if platform is not a stock cordova platform', function(done) {
+ it('Test 001: should throw if platform is not a stock cordova platform', function(done) {
lazy_load.cordova('atari').then(function() {
expect('this call').toEqual('to fail');
}, function(err) {
expect('' + err).toContain('Cordova library "atari" not recognized.');
}).fin(done);
});
- it('should invoke lazy_load.custom with appropriate url, platform, and version as specified in platforms manifest', function(done) {
+ it('Test 002 : should invoke lazy_load.custom with appropriate url, platform, and version as specified in platforms manifest', function(done) {
lazy_load.cordova('android').then(function(dir) {
expect(cachePackage).toHaveBeenCalled();
expect(dir).toBeDefined();
@@ -82,7 +82,7 @@ describe('lazy_load module', function() {
fire = spyOn(HooksRunner, 'fire').and.returnValue(Q());
});
- it('should callback with no errors and not fire event hooks if library already exists', function(done) {
+ it('Test 003 : should callback with no errors and not fire event hooks if library already exists', function(done) {
exists.and.returnValue(true);
var mock_platforms = {
'platform X': {
@@ -97,7 +97,7 @@ describe('lazy_load module', function() {
expect(err).not.toBeDefined();
}).fin(done);
});
- it('should callback with no errors and fire event hooks even if library already exists if the lib url is a local dir', function(done) {
+ it('Test 004 : should callback with no errors and fire event hooks even if library already exists if the lib url is a local dir', function(done) {
exists.and.returnValue(true);
var mock_platforms = {
'platform X': {
@@ -125,8 +125,8 @@ describe('lazy_load module', function() {
};
beforeEach(function() {
events = {};
- fakeRequest.on.reset();
- fakeRequest.pipe.reset();
+ fakeRequest.on.calls.reset();
+ fakeRequest.pipe.calls.reset();
req = spyOn(request, 'get').and.callFake(function() {
// Fire the 'end' event shortly.
setTimeout(function() {
@@ -138,7 +138,7 @@ describe('lazy_load module', function() {
spyOn(npm.config, 'get').and.returnValue(null);
});
- it('should call request with appropriate url params', function(done) {
+ it('Test 005 : should call request with appropriate url params', function(done) {
var url = 'https://github.com/apache/someplugin';
var with_android_platform = {
'android': {
@@ -155,7 +155,7 @@ describe('lazy_load module', function() {
expect(err).not.toBeDefined();
}).fin(done);
});
- it('should take into account https-proxy npm configuration var if exists for https:// calls', function(done) {
+ it('Test 006 : should take into account https-proxy npm configuration var if exists for https:// calls', function(done) {
var proxy = 'https://somelocalproxy.com';
npm.config.get.and.returnValue(proxy);
var url = 'https://github.com/apache/someplugin';
@@ -175,7 +175,7 @@ describe('lazy_load module', function() {
expect(err).not.toBeDefined();
}).fin(done);
});
- it('should take into account proxy npm config var if exists for http:// calls', function(done) {
+ it('Test 007 : should take into account proxy npm config var if exists for http:// calls', function(done) {
var proxy = 'http://somelocalproxy.com';
npm.config.get.and.returnValue(proxy);
var url = 'http://github.com/apache/someplugin';
@@ -198,7 +198,7 @@ describe('lazy_load module', function() {
});
describe('local paths for libraries', function() {
- it('should return the local path, no symlink', function(done) {
+ it('Test 009 : should return the local path, no symlink', function(done) {
var mock_platforms = {
'X': {
id: 'id',
@@ -212,7 +212,7 @@ describe('lazy_load module', function() {
expect(err).toBeUndefined();
}).fin(done);
});
- it('should not file download hook', function(done) {
+ it('Test 010 : should not file download hook', function(done) {
var mock_platforms = {
'X': {
id: 'id',
@@ -235,7 +235,7 @@ describe('lazy_load module', function() {
cordova = spyOn(lazy_load, 'cordova').and.returnValue(Q());
custom = spyOn(lazy_load, 'custom').and.returnValue(Q());
});
- it('should invoke custom if a custom lib is specified', function(done) {
+ it('Test 011 : should invoke custom if a custom lib is specified', function(done) {
read = spyOn(config, 'read').and.returnValue({
lib:{
maybe:{
@@ -260,7 +260,7 @@ describe('lazy_load module', function() {
expect(err).toBeUndefined();
}).fin(done);
});
- it('should invoke cordova if no custom lib is specified', function(done) {
+ it('Test 012 : should invoke cordova if no custom lib is specified', function(done) {
lazy_load.based_on_config('yup', 'ios').then(function() {
expect(cordova).toHaveBeenCalled();
}, function(err) {
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b33e222d/cordova-lib/spec-cordova/metadata/android_parser.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/metadata/android_parser.spec.js b/cordova-lib/spec-cordova/metadata/android_parser.spec.js
index 48c9d16..5d3d6db 100644
--- a/cordova-lib/spec-cordova/metadata/android_parser.spec.js
+++ b/cordova-lib/spec-cordova/metadata/android_parser.spec.js
@@ -52,8 +52,8 @@ describe('android project parser', function() {
var android_proj = path.join(proj, 'platforms', 'android');
var exists;
beforeEach(function() {
- exists = spyOn(fs, 'existsSync').andReturn(true);
- spyOn(config, 'has_custom_path').andReturn(false);
+ exists = spyOn(fs, 'existsSync').and.returnValue(true);
+ spyOn(config, 'has_custom_path').and.returnValue(false);
});
function errorWrapper(p, done, post) {
@@ -64,7 +64,7 @@ describe('android project parser', function() {
describe('constructions', function() {
it('should throw if provided directory does not contain an AndroidManifest.xml', function() {
- exists.andReturn(false);
+ exists.and.returnValue(false);
expect(function() {
new androidParser(android_proj);
}).toThrow();
@@ -98,11 +98,11 @@ describe('android project parser', function() {
p = new androidParser(android_proj);
cp = spyOn(shell, 'cp');
rm = spyOn(shell, 'rm');
- is_cordova = spyOn(util, 'isCordova').andReturn(android_proj);
+ is_cordova = spyOn(util, 'isCordova').and.returnValue(android_proj);
write = spyOn(fs, 'writeFileSync');
read = spyOn(fs, 'readFileSync');
mkdir = spyOn(shell, 'mkdir');
- spyOn(xmlHelpers, 'parseElementtreeSync').andCallFake(function(path) {
+ spyOn(xmlHelpers, 'parseElementtreeSync').and.callFake(function(path) {
if (/strings/.exec(path)) {
return stringsRoot = new et.ElementTree(et.XML(STRINGS_XML));
} else if (/AndroidManifest/.exec(path)) {
@@ -116,45 +116,45 @@ describe('android project parser', function() {
describe('update_from_config method', function() {
beforeEach(function() {
- spyOn(fs, 'readdirSync').andReturn([ path.join(android_proj, 'src', 'android_pkg', 'MyApp.java') ]);
+ spyOn(fs, 'readdirSync').and.returnValue([ path.join(android_proj, 'src', 'android_pkg', 'MyApp.java') ]);
cfg.name = function() { return 'testname'; };
cfg.packageName = function() { return 'testpkg'; };
cfg.version = function() { return 'one point oh'; };
- read.andReturn('package org.cordova.somepackage; public class MyApp extends CordovaActivity { }');
+ read.and.returnValue('package org.cordova.somepackage; public class MyApp extends CordovaActivity { }');
});
it('should write out the orientation preference value', function() {
- getOrientation.andCallThrough();
+ getOrientation.and.callThrough();
p.update_from_config(cfg);
expect(manifestRoot.getroot().find('./application/activity').attrib['android:screenOrientation']).toEqual('landscape');
});
it('should handle no orientation', function() {
- getOrientation.andReturn('');
+ getOrientation.and.returnValue('');
p.update_from_config(cfg);
expect(manifestRoot.getroot().find('./application/activity').attrib['android:screenOrientation']).toBeUndefined();
});
it('should handle default orientation', function() {
- getOrientation.andReturn(p.helper.ORIENTATION_DEFAULT);
+ getOrientation.and.returnValue(p.helper.ORIENTATION_DEFAULT);
p.update_from_config(cfg);
expect(manifestRoot.getroot().find('./application/activity').attrib['android:screenOrientation']).toBeUndefined();
});
it('should handle portrait orientation', function() {
- getOrientation.andReturn(p.helper.ORIENTATION_PORTRAIT);
+ getOrientation.and.returnValue(p.helper.ORIENTATION_PORTRAIT);
p.update_from_config(cfg);
expect(manifestRoot.getroot().find('./application/activity').attrib['android:screenOrientation']).toEqual('portrait');
});
it('should handle landscape orientation', function() {
- getOrientation.andReturn(p.helper.ORIENTATION_LANDSCAPE);
+ getOrientation.and.returnValue(p.helper.ORIENTATION_LANDSCAPE);
p.update_from_config(cfg);
expect(manifestRoot.getroot().find('./application/activity').attrib['android:screenOrientation']).toEqual('landscape');
});
it('should handle sensorLandscape orientation', function() {
- getOrientation.andReturn(p.helper.ORIENTATION_SENSOR_LANDSCAPE);
+ getOrientation.and.returnValue(p.helper.ORIENTATION_SENSOR_LANDSCAPE);
p.update_from_config(cfg2);
expect(manifestRoot.getroot().find('./application/activity').attrib['android:screenOrientation']).toEqual('sensorLandscape');
});
it('should handle custom orientation', function() {
- getOrientation.andReturn('some-custom-orientation');
+ getOrientation.and.returnValue('some-custom-orientation');
p.update_from_config(cfg);
expect(manifestRoot.getroot().find('./application/activity').attrib['android:screenOrientation']).toEqual('some-custom-orientation');
});
@@ -196,7 +196,7 @@ describe('android project parser', function() {
});
describe('update_overrides method', function() {
it('should do nothing if merges directory does not exist', function() {
- exists.andReturn(false);
+ exists.and.returnValue(false);
p.update_overrides();
expect(cp).not.toHaveBeenCalled();
});
@@ -219,7 +219,7 @@ describe('android project parser', function() {
});
it('should throw if update_from_config throws', function(done) {
var err = new Error('uh oh!');
- config.andCallFake(function() { throw err; });
+ config.and.callFake(function() { throw err; });
errorWrapper(p.update_project({}), done, function(err) {
expect(err).toEqual(err);
});
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b33e222d/cordova-lib/spec-cordova/metadata/blackberry_parser.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/metadata/blackberry_parser.spec.js b/cordova-lib/spec-cordova/metadata/blackberry_parser.spec.js
index 034681a..a9fbd20 100644
--- a/cordova-lib/spec-cordova/metadata/blackberry_parser.spec.js
+++ b/cordova-lib/spec-cordova/metadata/blackberry_parser.spec.js
@@ -52,10 +52,10 @@ describe('blackberry10 project parser', function() {
var proj = '/some/path';
var exists, custom;
beforeEach(function() {
- exists = spyOn(fs, 'existsSync').andReturn(true);
- custom = spyOn(config, 'has_custom_path').andReturn(false);
+ exists = spyOn(fs, 'existsSync').and.returnValue(true);
+ custom = spyOn(config, 'has_custom_path').and.returnValue(false);
spyOn(ConfigParser.prototype, 'write');
- spyOn(xmlHelpers, 'parseElementtreeSync').andCallFake(function() {
+ spyOn(xmlHelpers, 'parseElementtreeSync').and.callFake(function() {
return new et.ElementTree(et.XML(TEST_XML));
});
});
@@ -74,7 +74,7 @@ describe('blackberry10 project parser', function() {
describe('constructions', function() {
it('should throw an exception with a path that is not a native blackberry project', function() {
- exists.andReturn(false);
+ exists.and.returnValue(false);
expect(function() {
new blackberryParser(proj);
}).toThrow();
@@ -104,7 +104,7 @@ describe('blackberry10 project parser', function() {
cp = spyOn(shell, 'cp');
rm = spyOn(shell, 'rm');
mkdir = spyOn(shell, 'mkdir');
- is_cordova = spyOn(util, 'isCordova').andReturn(proj);
+ is_cordova = spyOn(util, 'isCordova').and.returnValue(proj);
write = spyOn(fs, 'writeFileSync');
read = spyOn(fs, 'readFileSync');
});
@@ -165,7 +165,7 @@ describe('blackberry10 project parser', function() {
});
describe('update_overrides method', function() {
it('should do nothing if merges directory does not exist', function() {
- exists.andReturn(false);
+ exists.and.returnValue(false);
p.update_overrides();
expect(cp).not.toHaveBeenCalled();
});
@@ -181,7 +181,7 @@ describe('blackberry10 project parser', function() {
www = spyOn(p, 'update_www');
overrides = spyOn(p, 'update_overrides');
svn = spyOn(util, 'deleteSvnFolders');
- parse = spyOn(JSON, 'parse').andReturn({blackberry:{qnx:{}}});
+ parse = spyOn(JSON, 'parse').and.returnValue({blackberry:{qnx:{}}});
});
it('should call update_from_config', function(done) {
wrapper(p.update_project(), done, function() {
@@ -190,7 +190,7 @@ describe('blackberry10 project parser', function() {
});
it('should throw if update_from_config throws', function(done) {
var err = new Error('uh oh!');
- config.andCallFake(function() { throw err; });
+ config.and.callFake(function() { throw err; });
errorWrapper(p.update_project({}), done, function(e) {
expect(e).toEqual(err);
});
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b33e222d/cordova-lib/spec-cordova/metadata/browser_parser.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/metadata/browser_parser.spec.js b/cordova-lib/spec-cordova/metadata/browser_parser.spec.js
index 4d640fe..0914006 100644
--- a/cordova-lib/spec-cordova/metadata/browser_parser.spec.js
+++ b/cordova-lib/spec-cordova/metadata/browser_parser.spec.js
@@ -30,7 +30,7 @@ describe('browser project parser', function() {
var exists, origDirExists;
beforeEach(function() {
- exists = spyOn(fs, 'existsSync').andReturn(true);
+ exists = spyOn(fs, 'existsSync').and.returnValue(true);
origDirExists = browserParser.__get__('dirExists');
browserParser.__set__('dirExists', function () {
return true;
@@ -67,7 +67,7 @@ describe('browser project parser', function() {
cp = spyOn(shell, 'cp');
rm = spyOn(shell, 'rm');
mkdir = spyOn(shell, 'mkdir');
- is_cordova = spyOn(util, 'isCordova').andReturn(proj);
+ is_cordova = spyOn(util, 'isCordova').and.returnValue(proj);
});
describe('www_dir method', function() {
@@ -92,7 +92,7 @@ describe('browser project parser', function() {
describe('update_overrides method', function() {
it('should do nothing if merges directory does not exist', function() {
- exists.andReturn(false);
+ exists.and.returnValue(false);
p.update_overrides();
expect(cp).not.toHaveBeenCalled();
});
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org