http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b33e222d/cordova-lib/spec-cordova/metadata/firefoxos_parser.spec.js ---------------------------------------------------------------------- diff --git a/cordova-lib/spec-cordova/metadata/firefoxos_parser.spec.js b/cordova-lib/spec-cordova/metadata/firefoxos_parser.spec.js index 295e54e..ea09574 100644 --- a/cordova-lib/spec-cordova/metadata/firefoxos_parser.spec.js +++ b/cordova-lib/spec-cordova/metadata/firefoxos_parser.spec.js @@ -43,11 +43,11 @@ describe('firefoxos project parser', function() { var proj = path.join('some', 'path'); var exists, exec, custom; beforeEach(function() { - exists = spyOn(fs, 'existsSync').andReturn(true); - exec = spyOn(shell, 'exec').andCallFake(function(cmd, opts, cb) { + exists = spyOn(fs, 'existsSync').and.returnValue(true); + exec = spyOn(shell, 'exec').and.callFake(function(cmd, opts, cb) { cb(0, ''); }); - custom = spyOn(config, 'has_custom_path').andReturn(false); + custom = spyOn(config, 'has_custom_path').and.returnValue(false); }); describe('constructions', function() { @@ -77,11 +77,11 @@ describe('firefoxos project parser', function() { p = new firefoxosParser(ff_proj); cp = spyOn(shell, 'cp'); rm = spyOn(shell, 'rm'); - is_cordova = spyOn(util, 'isCordova').andReturn(proj); + is_cordova = spyOn(util, 'isCordova').and.returnValue(proj); write = spyOn(fs, 'writeFileSync'); read = spyOn(fs, 'readFileSync'); - spyOn(JSON, 'parse').andCallFake(function (path) { + spyOn(JSON, 'parse').and.callFake(function (path) { if (/manifest.webapp$/.exec(path)) { return manifestJson = _.extend({}, MANIFEST_JSON); } else { @@ -96,39 +96,39 @@ describe('firefoxos project parser', function() { cfg.name = function() { return 'testname'; }; cfg.packageName = function() { return 'testpkg'; }; cfg.version = function() { return '1.0'; }; - read.andReturn(p.manifest_path); + read.and.returnValue(p.manifest_path); }); it('should write manifest.webapp', function() { p.update_from_config(cfg); - expect(write.mostRecentCall.args[0]).toEqual(p.manifest_path); + expect(write.calls.mostRecent().args[0]).toEqual(p.manifest_path); }); it('should write out the orientation preference value', function() { - getOrientation.andCallThrough(); + getOrientation.and.callThrough(); p.update_from_config(cfg); expect(manifestJson.orientation).toEqual([ 'portrait' ]); }); it('should handle no orientation', function () { - getOrientation.andReturn(''); + getOrientation.and.returnValue(''); p.update_from_config(cfg); expect(manifestJson.orientation).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(manifestJson.orientation).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(manifestJson.orientation).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(manifestJson.orientation).toEqual([ 'landscape' ]); }); it('should handle custom orientation', function () { - getOrientation.andReturn('some-custom-orientation'); + getOrientation.and.returnValue('some-custom-orientation'); p.update_from_config(cfg); expect(manifestJson.orientation).toEqual([ 'some-custom-orientation' ]); });
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b33e222d/cordova-lib/spec-cordova/metadata/ios_parser.spec.js ---------------------------------------------------------------------- diff --git a/cordova-lib/spec-cordova/metadata/ios_parser.spec.js b/cordova-lib/spec-cordova/metadata/ios_parser.spec.js index 736d48a..3284c8c 100644 --- a/cordova-lib/spec-cordova/metadata/ios_parser.spec.js +++ b/cordova-lib/spec-cordova/metadata/ios_parser.spec.js @@ -41,7 +41,7 @@ var cfg2 = new ConfigParser(path.join(__dirname, '..', 'test-config-2.xml')); describe('ios project parser', function () { var custom; beforeEach(function() { - custom = spyOn(config, 'has_custom_path').andReturn(false); + custom = spyOn(config, 'has_custom_path').and.returnValue(false); shell.mkdir('-p', ios_proj); shell.cp('-rf', iosProjectFixture + '/*', ios_proj); }); @@ -90,7 +90,7 @@ describe('ios project parser', function () { var p, is_cordova, getOrientation; beforeEach(function() { p = new iosParser(ios_proj); - is_cordova = spyOn(util, 'isCordova').andReturn(proj); + is_cordova = spyOn(util, 'isCordova').and.returnValue(proj); getOrientation = spyOn(p.helper, 'getOrientation'); }); @@ -101,13 +101,13 @@ describe('ios project parser', function () { var xcOrig = xcode.project; beforeEach(function() { mv = spyOn(shell, 'mv'); - plist_parse = spyOn(plist, 'parse').andReturn({ + plist_parse = spyOn(plist, 'parse').and.returnValue({ }); - plist_build = spyOn(plist, 'build').andReturn(''); + plist_build = spyOn(plist, 'build').and.returnValue(''); xc = spyOn(xcode, 'project') - .andCallFake(function (pbxproj) { + .and.callFake(function (pbxproj) { var xc = new xcOrig(pbxproj); - update_name = spyOn(xc, 'updateProductName').andCallThrough(); + update_name = spyOn(xc, 'updateProductName').and.callThrough(); return xc; }); cfg.name = function() { return 'testname'; }; @@ -144,7 +144,7 @@ describe('ios project parser', function () { }); }); it('should write out the orientation preference value', function(done) { - getOrientation.andCallThrough(); + getOrientation.and.callThrough(); wrapper(p.update_from_config(cfg), done, function() { expect(plist_build.mostRecentCall.args[0].UISupportedInterfaceOrientations).toEqual([ 'UIInterfaceOrientationPortrait', 'UIInterfaceOrientationPortraitUpsideDown' ]); expect(plist_build.mostRecentCall.args[0]['UISupportedInterfaceOrientations~ipad']).toEqual([ 'UIInterfaceOrientationPortrait', 'UIInterfaceOrientationPortraitUpsideDown' ]); @@ -152,7 +152,7 @@ describe('ios project parser', function () { }); }); it('should handle no orientation', function(done) { - getOrientation.andReturn(''); + getOrientation.and.returnValue(''); wrapper(p.update_from_config(cfg), done, function() { expect(plist_build.mostRecentCall.args[0].UISupportedInterfaceOrientations).toBeUndefined(); expect(plist_build.mostRecentCall.args[0]['UISupportedInterfaceOrientations~ipad']).toBeUndefined(); @@ -160,7 +160,7 @@ describe('ios project parser', function () { }); }); it('should handle default orientation', function(done) { - getOrientation.andReturn(p.helper.ORIENTATION_DEFAULT); + getOrientation.and.returnValue(p.helper.ORIENTATION_DEFAULT); wrapper(p.update_from_config(cfg), done, function() { expect(plist_build.mostRecentCall.args[0].UISupportedInterfaceOrientations).toBeUndefined(); expect(plist_build.mostRecentCall.args[0]['UISupportedInterfaceOrientations~ipad']).toBeUndefined(); @@ -168,28 +168,28 @@ describe('ios project parser', function () { }); }); it('should handle portrait orientation', function(done) { - getOrientation.andReturn(p.helper.ORIENTATION_PORTRAIT); + getOrientation.and.returnValue(p.helper.ORIENTATION_PORTRAIT); wrapper(p.update_from_config(cfg), done, function() { expect(plist_build.mostRecentCall.args[0].UISupportedInterfaceOrientations).toEqual([ 'UIInterfaceOrientationPortrait', 'UIInterfaceOrientationPortraitUpsideDown' ]); expect(plist_build.mostRecentCall.args[0].UIInterfaceOrientation).toEqual([ 'UIInterfaceOrientationPortrait' ]); }); }); it('should handle landscape orientation', function(done) { - getOrientation.andReturn(p.helper.ORIENTATION_LANDSCAPE); + getOrientation.and.returnValue(p.helper.ORIENTATION_LANDSCAPE); wrapper(p.update_from_config(cfg), done, function() { expect(plist_build.mostRecentCall.args[0].UISupportedInterfaceOrientations).toEqual([ 'UIInterfaceOrientationLandscapeLeft', 'UIInterfaceOrientationLandscapeRight' ]); expect(plist_build.mostRecentCall.args[0].UIInterfaceOrientation).toEqual([ 'UIInterfaceOrientationLandscapeLeft' ]); }); }); it('should handle all orientation on ios', function(done) { - getOrientation.andReturn(p.helper.ORIENTATION_ALL); + getOrientation.and.returnValue(p.helper.ORIENTATION_ALL); wrapper(p.update_from_config(cfg2), done, function() { expect(plist_build.mostRecentCall.args[0].UISupportedInterfaceOrientations).toEqual([ 'UIInterfaceOrientationPortrait', 'UIInterfaceOrientationPortraitUpsideDown', 'UIInterfaceOrientationLandscapeLeft', 'UIInterfaceOrientationLandscapeRight' ]); expect(plist_build.mostRecentCall.args[0].UIInterfaceOrientation).toEqual([ 'UIInterfaceOrientationPortrait' ]); }); }); it('should handle custom orientation', function(done) { - getOrientation.andReturn('some-custom-orientation'); + getOrientation.and.returnValue('some-custom-orientation'); wrapper(p.update_from_config(cfg), done, function() { expect(plist_build.mostRecentCall.args[0].UISupportedInterfaceOrientations).toBeUndefined(); expect(plist_build.mostRecentCall.args[0].UIInterfaceOrientation).toEqual([ 'some-custom-orientation' ]); @@ -429,8 +429,8 @@ describe('ios project parser', function () { var cp, rm; beforeEach(function () { - rm = spyOn(shell, 'rm').andCallThrough(); - cp = spyOn(shell, 'cp').andCallThrough(); + rm = spyOn(shell, 'rm').and.callThrough(); + cp = spyOn(shell, 'cp').and.callThrough(); }); it('should rm project-level www and cp in platform agnostic www', function() { @@ -442,20 +442,20 @@ describe('ios project parser', function () { describe('update_overrides method', function() { var exists, rm, cp; beforeEach(function() { - exists = spyOn(fs, 'existsSync').andCallThrough(); - rm = spyOn(shell, 'rm').andCallThrough(); - cp = spyOn(shell, 'cp').andCallThrough(); + exists = spyOn(fs, 'existsSync').and.callThrough(); + rm = spyOn(shell, 'rm').and.callThrough(); + cp = spyOn(shell, 'cp').and.callThrough(); }); it('should do nothing if merges directory does not exist', function() { - cp.reset(); - exists.andReturn(false); + cp.calls.reset(); + exists.and.returnValue(false); p.update_overrides(); expect(cp).not.toHaveBeenCalled(); }); it('should copy merges path into www', function() { - cp.andCallFake(function(){}); - cp.reset(); - exists.andReturn(true); + cp.and.callFake(function(){}); + cp.calls.reset(); + exists.and.returnValue(true); p.update_overrides(); expect(cp).toHaveBeenCalled(); }); @@ -463,7 +463,7 @@ describe('ios project parser', function () { describe('update_project method', function() { var config, www, overrides, svn; beforeEach(function() { - config = spyOn(p, 'update_from_config').andReturn(Q()); + config = spyOn(p, 'update_from_config').and.returnValue(Q()); www = spyOn(p, 'update_www'); overrides = spyOn(p, 'update_overrides'); svn = spyOn(util, 'deleteSvnFolders'); @@ -475,7 +475,7 @@ describe('ios project parser', function () { }); it('should throw if update_from_config errors', function(done) { var e = new Error('uh oh!'); - config.andReturn(Q.reject(e)); + config.and.returnValue(Q.reject(e)); errorWrapper(p.update_project({}), done, function(err) { expect(err).toEqual(e); }); http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b33e222d/cordova-lib/spec-cordova/metadata/parserhelper/preferences.spec.js ---------------------------------------------------------------------- diff --git a/cordova-lib/spec-cordova/metadata/parserhelper/preferences.spec.js b/cordova-lib/spec-cordova/metadata/parserhelper/preferences.spec.js index 3344bff..0b4ecff 100644 --- a/cordova-lib/spec-cordova/metadata/parserhelper/preferences.spec.js +++ b/cordova-lib/spec-cordova/metadata/parserhelper/preferences.spec.js @@ -105,13 +105,13 @@ describe('preferences', function() { var configXml, configParser; configXml = '<?xml version="1.0" encoding="UTF-8"?><widget><preference name="orientation" value="all" /></widget>'; - readFile.andReturn(configXml); + readFile.and.returnValue(configXml); configParser = new ConfigParser(xml); expect(preferences.getOrientation(configParser, 'ios')).toEqual('all'); configXml = '<?xml version="1.0" encoding="UTF-8"?><widget><preference name="orientation" value="sensorLandscape" /></widget>'; - readFile.andReturn(configXml); + readFile.and.returnValue(configXml); configParser = new ConfigParser(xml); expect(preferences.getOrientation(configParser, 'android')).toEqual('sensorLandscape'); @@ -119,14 +119,14 @@ describe('preferences', function() { it('should handle no orientation', function() { var configXml = '<?xml version="1.0" encoding="UTF-8"?><widget></widget>'; - readFile.andReturn(configXml); + readFile.and.returnValue(configXml); var configParser = new ConfigParser(xml); expect(preferences.getOrientation(configParser)).toEqual(''); expect(emit).not.toHaveBeenCalled(); }); it('should handle invalid global orientation', function() { var configXml = '<?xml version="1.0" encoding="UTF-8"?><widget><preference name="orientation" value="foobar" /></widget>'; - readFile.andReturn(configXml); + readFile.and.returnValue(configXml); var configParser = new ConfigParser(xml); expect(preferences.getOrientation(configParser)).toEqual('default'); expect(emit).toHaveBeenCalledWith('warn', 'Unsupported global orientation: foobar'); @@ -135,7 +135,7 @@ describe('preferences', function() { it('should handle custom platform-specific orientation', function() { var configXml = '<?xml version="1.0" encoding="UTF-8"?><widget><platform name="some-platform"><preference name="orientation" value="foobar" /></platform></widget>'; - readFile.andReturn(configXml); + readFile.and.returnValue(configXml); var configParser = new ConfigParser(xml); expect(preferences.getOrientation(configParser, 'some-platform')).toEqual('foobar'); }); http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b33e222d/cordova-lib/spec-cordova/metadata/webos_parser.spec.js ---------------------------------------------------------------------- diff --git a/cordova-lib/spec-cordova/metadata/webos_parser.spec.js b/cordova-lib/spec-cordova/metadata/webos_parser.spec.js index 5dad2e9..4641339 100755 --- a/cordova-lib/spec-cordova/metadata/webos_parser.spec.js +++ b/cordova-lib/spec-cordova/metadata/webos_parser.spec.js @@ -29,11 +29,11 @@ describe('webos project parser', function() { var proj = path.join('some', 'path'); var exists, exec, custom; beforeEach(function() { - exists = spyOn(fs, 'existsSync').andReturn(true); - exec = spyOn(shell, 'exec').andCallFake(function(cmd, opts, cb) { + exists = spyOn(fs, 'existsSync').and.returnValue(true); + exec = spyOn(shell, 'exec').and.callFake(function(cmd, opts, cb) { cb(0, ''); }); - custom = spyOn(config, 'has_custom_path').andReturn(false); + custom = spyOn(config, 'has_custom_path').and.returnValue(false); }); describe('constructions', function() { @@ -52,9 +52,9 @@ describe('webos project parser', function() { p = new webosParser(wos_proj); cp = spyOn(shell, 'cp'); rm = spyOn(shell, 'rm'); - is_cordova = spyOn(util, 'isCordova').andReturn(proj); + is_cordova = spyOn(util, 'isCordova').and.returnValue(proj); write = spyOn(fs, 'writeFileSync'); - read = spyOn(fs, 'readFileSync').andReturn(''); + read = spyOn(fs, 'readFileSync').and.returnValue(''); }); describe('update_from_config method', function() { http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b33e222d/cordova-lib/spec-cordova/metadata/windows_parser.spec.js ---------------------------------------------------------------------- diff --git a/cordova-lib/spec-cordova/metadata/windows_parser.spec.js b/cordova-lib/spec-cordova/metadata/windows_parser.spec.js index 3f3bf11..2a2b4f6 100644 --- a/cordova-lib/spec-cordova/metadata/windows_parser.spec.js +++ b/cordova-lib/spec-cordova/metadata/windows_parser.spec.js @@ -41,13 +41,13 @@ describe('windows project parser', function() { var exists, exec, custom, readdir, config_read; var winXml; beforeEach(function() { - exists = spyOn(fs, 'existsSync').andReturn(true); - exec = spyOn(child_process, 'exec').andCallFake(function(cmd, opts, cb) { + exists = spyOn(fs, 'existsSync').and.returnValue(true); + exec = spyOn(child_process, 'exec').and.callFake(function(cmd, opts, cb) { if (!cb) cb = opts; cb(null, '', ''); }); - custom = spyOn(config, 'has_custom_path').andReturn(false); - config_read = spyOn(config, 'read').andCallFake(function() { + custom = spyOn(config, 'has_custom_path').and.returnValue(false); + config_read = spyOn(config, 'read').and.callFake(function() { return custom() ? { lib: { windows: { @@ -57,9 +57,9 @@ describe('windows project parser', function() { } : ({}); }); - readdir = spyOn(fs, 'readdirSync').andReturn(['TestApp.projitems']); + readdir = spyOn(fs, 'readdirSync').and.returnValue(['TestApp.projitems']); winXml = null; - spyOn(xmlHelpers, 'parseElementtreeSync').andCallFake(function(path) { + spyOn(xmlHelpers, 'parseElementtreeSync').and.callFake(function(path) { return winXml = new et.ElementTree(et.XML('<foo><Application/><Identity/><VisualElements><a/></VisualElements><Capabilities><a/></Capabilities></foo>')); }); }); @@ -78,7 +78,7 @@ describe('windows project parser', function() { describe('constructions', function() { it('should throw if provided directory does not contain a projitems file', function() { - readdir.andReturn([]); + readdir.and.returnValue([]); expect(function() { new windowsParser(proj); }).toThrow(); @@ -108,9 +108,9 @@ describe('windows project parser', function() { rm = spyOn(shell, 'rm'); mv = spyOn(shell, 'mv'); 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').andReturn(''); + read = spyOn(fs, 'readFileSync').and.returnValue(''); }); describe('update_from_config method', function() { @@ -142,10 +142,10 @@ describe('windows project parser', function() { beforeEach(function() { config = spyOn(parser, 'update_from_config'); www = spyOn(parser, 'update_www'); - shellls = spyOn(shell, 'ls').andReturn([]); + shellls = spyOn(shell, 'ls').and.returnValue([]); svn = spyOn(util, 'deleteSvnFolders'); - exists.andReturn(false); - fire = spyOn(HooksRunner.prototype, 'fire').andReturn(Q()); + exists.and.returnValue(false); + fire = spyOn(HooksRunner.prototype, 'fire').and.returnValue(Q()); }); it('should call update_from_config', function() { parser.update_project(); @@ -153,7 +153,7 @@ describe('windows 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(parser.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/wp8_parser.spec.js ---------------------------------------------------------------------- diff --git a/cordova-lib/spec-cordova/metadata/wp8_parser.spec.js b/cordova-lib/spec-cordova/metadata/wp8_parser.spec.js index a8059ec..9471874 100644 --- a/cordova-lib/spec-cordova/metadata/wp8_parser.spec.js +++ b/cordova-lib/spec-cordova/metadata/wp8_parser.spec.js @@ -57,12 +57,12 @@ describe('wp8 project parser', function() { var exists, exec, custom, readdir, config_read; var manifestXml, projXml, mainPageXamlXml; beforeEach(function() { - exists = spyOn(fs, 'existsSync').andReturn(true); - exec = spyOn(child_process, 'exec').andCallFake(function(cmd, opts, cb) { + exists = spyOn(fs, 'existsSync').and.returnValue(true); + exec = spyOn(child_process, 'exec').and.callFake(function(cmd, opts, cb) { (cb || opts)(0, '', ''); }); - custom = spyOn(config, 'has_custom_path').andReturn(false); - config_read = spyOn(config, 'read').andCallFake(function() { + custom = spyOn(config, 'has_custom_path').and.returnValue(false); + config_read = spyOn(config, 'read').and.callFake(function() { return custom() ? { lib: { wp8: { @@ -72,9 +72,9 @@ describe('wp8 project parser', function() { } : ({}); }); - readdir = spyOn(fs, 'readdirSync').andReturn(['test.csproj']); + readdir = spyOn(fs, 'readdirSync').and.returnValue(['test.csproj']); projXml = manifestXml = mainPageXamlXml = null; - spyOn(xmlHelpers, 'parseElementtreeSync').andCallFake(function(path) { + spyOn(xmlHelpers, 'parseElementtreeSync').and.callFake(function(path) { if (/WMAppManifest.xml$/.exec(path)) { return manifestXml = new et.ElementTree(et.XML(MANIFEST_XML)); } else if (/csproj$/.exec(path)) { @@ -103,7 +103,7 @@ describe('wp8 project parser', function() { describe('constructions', function() { it('should throw if provided directory does not contain a csproj file', function() { - readdir.andReturn([]); + readdir.and.returnValue([]); expect(function() { new wp8Parser(proj); }).toThrow(); @@ -134,9 +134,9 @@ describe('wp8 project parser', function() { rm = spyOn(shell, 'rm'); mv = spyOn(shell, 'mv'); 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').andReturn(''); + read = spyOn(fs, 'readFileSync').and.returnValue(''); getOrientation = spyOn(p.helper, 'getOrientation'); }); @@ -146,7 +146,7 @@ describe('wp8 project parser', function() { cfg.content = function() { return 'index.html'; }; cfg.packageName = function() { return 'testpkg'; }; cfg.version = function() { return 'one point oh'; }; - readdir.andReturn(['test.sln']); + readdir.and.returnValue(['test.sln']); }); it('should write out the app name to wmappmanifest.xml', function() { @@ -165,37 +165,37 @@ describe('wp8 project parser', function() { expect(appEl.attrib.Version).toEqual('one point oh'); }); it('should write out the orientation preference value', function() { - getOrientation.andCallThrough(); + getOrientation.and.callThrough(); p.update_from_config(cfg); expect(mainPageXamlXml.getroot().attrib['SupportedOrientations']).toEqual('portrait'); expect(mainPageXamlXml.getroot().attrib['Orientation']).toEqual('portrait'); }); it('should handle no orientation', function() { - getOrientation.andReturn(''); + getOrientation.and.returnValue(''); p.update_from_config(cfg); expect(mainPageXamlXml.getroot().attrib['SupportedOrientations']).toBeUndefined(); expect(mainPageXamlXml.getroot().attrib['Orientation']).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(mainPageXamlXml.getroot().attrib['SupportedOrientations']).toBeUndefined(); expect(mainPageXamlXml.getroot().attrib['Orientation']).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(mainPageXamlXml.getroot().attrib['SupportedOrientations']).toEqual('portrait'); expect(mainPageXamlXml.getroot().attrib['Orientation']).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(mainPageXamlXml.getroot().attrib['SupportedOrientations']).toEqual('landscape'); expect(mainPageXamlXml.getroot().attrib['Orientation']).toEqual('landscape'); }); it('should handle custom orientation', function() { - getOrientation.andReturn('some-custom-orientation'); + getOrientation.and.returnValue('some-custom-orientation'); p.update_from_config(cfg); expect(mainPageXamlXml.getroot().attrib['SupportedOrientations']).toBeUndefined(); expect(mainPageXamlXml.getroot().attrib['Orientation']).toEqual('some-custom-orientation'); @@ -228,8 +228,8 @@ describe('wp8 project parser', function() { config = spyOn(p, 'update_from_config'); www = spyOn(p, 'update_www'); svn = spyOn(util, 'deleteSvnFolders'); - exists.andReturn(false); - fire = spyOn(HooksRunner.prototype, 'fire').andReturn(Q()); + exists.and.returnValue(false); + fire = spyOn(HooksRunner.prototype, 'fire').and.returnValue(Q()); }); it('should call update_from_config', function(done) { wrapper(p.update_project(), done, function() { @@ -238,7 +238,7 @@ describe('wp8 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/platform.spec.ios.js ---------------------------------------------------------------------- diff --git a/cordova-lib/spec-cordova/platform.spec.ios.js b/cordova-lib/spec-cordova/platform.spec.ios.js index 6f0bd03..d46fc6a 100644 --- a/cordova-lib/spec-cordova/platform.spec.ios.js +++ b/cordova-lib/spec-cordova/platform.spec.ios.js @@ -44,7 +44,7 @@ describe('cocoapod plugin add and rm end-to-end', function () { shell.rm('-rf', tmpDir); }); - it('installs and uninstalls plugin depending on new pod and existing pod', function(done) { + it('Test 001 : installs and uninstalls plugin depending on new pod and existing pod', function(done) { cordova.raw.create('hello4') .then(function() { http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b33e222d/cordova-lib/spec-cordova/platform.spec.js ---------------------------------------------------------------------- diff --git a/cordova-lib/spec-cordova/platform.spec.js b/cordova-lib/spec-cordova/platform.spec.js index 63ad2bb..1a40130 100644 --- a/cordova-lib/spec-cordova/platform.spec.js +++ b/cordova-lib/spec-cordova/platform.spec.js @@ -97,7 +97,7 @@ describe('platform end-to-end', function () { // They should run the appropriate hooks. // They should fail when not inside a Cordova project. // These tests deliberately have no beforeEach and afterEach that are cleaning things up. - it('should successfully run', function(done) { + it('Test 001 : should successfully run', function(done) { // Check there are no platforms yet. emptyPlatformList().then(function() { @@ -127,7 +127,7 @@ describe('platform end-to-end', function () { }).fin(done); }); - it('should install plugins correctly while adding platform', function(done) { + it('Test 002 : should install plugins correctly while adding platform', function(done) { cordova.raw.plugin('add', path.join(pluginsDir, 'test')) .then(function() { @@ -145,7 +145,7 @@ describe('platform end-to-end', function () { .fin(done); }); - it('should call prepare after plugins were installed into platform', function(done) { + it('Test 003 : should call prepare after plugins were installed into platform', function(done) { var order = ''; var fail = jasmine.createSpy(fail); spyOn(plugman.raw, 'install').and.callFake(function() { order += 'I'; }); @@ -177,7 +177,7 @@ describe('add function', function () { }; }); - it('throws if the target list is empty', function (done) { + it('Test 004 : throws if the target list is empty', function (done) { var targets = []; platform.add(hooksRunnerMock, projectRoot, targets, opts).fail(function (error) { expect(error.message).toBe('No platform specified. Please specify a platform to add. See `cordova platform list`.'); @@ -185,7 +185,7 @@ describe('add function', function () { }); }); - it('throws if the target list is undefined or null', function (done) { + it('Test 005 : throws if the target list is undefined or null', function (done) { // case 1 : target list undefined var targets; // = undefined; @@ -217,7 +217,7 @@ describe('platform add plugin rm end-to-end', function () { shell.rm('-rf', tmpDir); }); - it('should remove dependency when removing parent plugin', function(done) { + it('Test 006 : should remove dependency when removing parent plugin', function(done) { cordova.raw.create('hello') .then(function() { @@ -230,7 +230,7 @@ describe('platform add plugin rm end-to-end', function () { .then(function() { expect(path.join(pluginsDir, 'cordova-plugin-media')).toExist(); expect(path.join(pluginsDir, 'cordova-plugin-file')).toExist(); - return cordova.raw.platform('add', 'android@latest'); + return cordova.raw.platform('add', 'android'); }) .then(function() { expect(path.join(pluginsDir, 'cordova-plugin-media')).toExist(); @@ -246,7 +246,7 @@ describe('platform add plugin rm end-to-end', function () { expect(err).toBeUndefined(); }) .fin(done); - }, 20000); + }, 100000); }); describe('platform add and remove --fetch', function () { @@ -265,7 +265,7 @@ describe('platform add and remove --fetch', function () { shell.rm('-rf', tmpDir); }); - it('should add and remove platform from node_modules directory', function(done) { + it('Test 007 : should add and remove platform from node_modules directory', function(done) { cordova.raw.create('helloFetch') .then(function() { @@ -298,7 +298,7 @@ describe('platform add and remove --fetch', function () { expect(err).toBeUndefined(); }) .fin(done); - }, 40000); + }, 100000); }); describe('plugin add and rm end-to-end --fetch', function () { @@ -316,7 +316,7 @@ describe('plugin add and rm end-to-end --fetch', function () { shell.rm('-rf', tmpDir); }); - it('should remove dependency when removing parent plugin', function(done) { + it('Test 008 : should remove dependency when removing parent plugin', function(done) { cordova.raw.create('hello3') .then(function() { @@ -354,5 +354,5 @@ describe('plugin add and rm end-to-end --fetch', function () { expect(err).toBeUndefined(); }) .fin(done); - }, 60000); + }, 100000); }); http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b33e222d/cordova-lib/spec-cordova/platforms/PlatformApiPoly.spec.js ---------------------------------------------------------------------- diff --git a/cordova-lib/spec-cordova/platforms/PlatformApiPoly.spec.js b/cordova-lib/spec-cordova/platforms/PlatformApiPoly.spec.js index 4e29064..e88932c 100644 --- a/cordova-lib/spec-cordova/platforms/PlatformApiPoly.spec.js +++ b/cordova-lib/spec-cordova/platforms/PlatformApiPoly.spec.js @@ -71,7 +71,7 @@ describe('PlatformApi polyfill', function () { beforeEach(function () { var originalParseElementtreeSync = xmlHelpers.parseElementtreeSync; - spyOn(xmlHelpers, 'parseElementtreeSync').andCallFake(function (configPath) { + spyOn(xmlHelpers, 'parseElementtreeSync').and.callFake(function (configPath) { return /config\.xml$/.test(configPath) ? new et.ElementTree(et.XML(TEST_XML)) : originalParseElementtreeSync(configPath); }); @@ -117,7 +117,7 @@ describe('PlatformApi polyfill', function () { var FAKE_PROJECT, FAKE_CONFIG, OPTIONS, getPlatformApi, fail, success; beforeEach(function () { - getPlatformApi = spyOn(knownPlatforms, 'getPlatformApi').andReturn(platformApi); + getPlatformApi = spyOn(knownPlatforms, 'getPlatformApi').and.returnValue(platformApi); spyOn(shell, 'cp'); spyOn(shell, 'rm'); @@ -136,7 +136,7 @@ describe('PlatformApi polyfill', function () { var spawn; beforeEach(function () { - spawn = spyOn(superspawn, 'spawn').andReturn(Q()); + spawn = spyOn(superspawn, 'spawn').and.returnValue(Q()); }); it('should create/update platform through running platforms\' scripts', function (done) { @@ -144,7 +144,7 @@ describe('PlatformApi polyfill', function () { PlatformApiPoly.updatePlatform(PLATFORM_ROOT, OPTIONS)]) .then(function () { expect(spawn).toHaveBeenCalled(); - expect(spawn.calls.length).toBe(2); + expect(spawn.calls.count()).toBe(2); }).fail(function (err) { expect(err).not.toBeDefined(); }).fin(done); @@ -155,11 +155,11 @@ describe('PlatformApi polyfill', function () { PlatformApiPoly.updatePlatform(PLATFORM_ROOT, OPTIONS)]) .then(function () { expect(spawn).toHaveBeenCalled(); - expect(spawn.calls.length).toBe(2); - expect(spawn.calls[0].args[0]).toBe(path.join(PLATFORM_LIB, 'bin/create')); - expect(spawn.calls[0].args[1]).toContain(PLATFORM_ROOT); - expect(spawn.calls[1].args[0]).toBe(path.join(PLATFORM_LIB, 'bin/update')); - expect(spawn.calls[1].args[1]).toContain(PLATFORM_ROOT); + expect(spawn.calls.count()).toBe(2); + expect(spawn.calls.argsFor(0)[0]).toBe(path.join(PLATFORM_LIB, 'bin/create')); + expect(spawn.calls.argsFor(0)[1]).toContain(PLATFORM_ROOT); + expect(spawn.calls.argsFor(1)[0]).toBe(path.join(PLATFORM_LIB, 'bin/update')); + expect(spawn.calls.argsFor(1)[1]).toContain(PLATFORM_ROOT); }).fail(function (err) { expect(err).not.toBeDefined(); }).fin(done); @@ -170,7 +170,7 @@ describe('PlatformApi polyfill', function () { PlatformApiPoly.updatePlatform(PLATFORM_ROOT, OPTIONS)]) .then(function () { expect(shell.cp).toHaveBeenCalled(); - expect(shell.cp.calls.length).toBe(2); + expect(shell.cp.calls.count()).toBe(2); }).fail(fail) .fin(function () { expect(fail).not.toHaveBeenCalled(); @@ -195,7 +195,7 @@ describe('PlatformApi polyfill', function () { describe('prepare method', function () { beforeEach(function () { spyOn(platformApi._parser, 'update_www'); - spyOn(platformApi._parser, 'update_project').andReturn(Q()); + spyOn(platformApi._parser, 'update_project').and.returnValue(Q()); }); it('should return promise', function (done) { @@ -225,7 +225,7 @@ describe('PlatformApi polyfill', function () { beforeEach(function () { plugin = new PluginInfo(DUMMY_PLUGIN); - actionsProcess = spyOn(ActionStack.prototype, 'process').andCallThrough(); + actionsProcess = spyOn(ActionStack.prototype, 'process').and.callThrough(); }); it('should return promise', function (done) { @@ -289,7 +289,7 @@ describe('PlatformApi polyfill', function () { Q.all(ops) .then(function () { expect(spawnSpy).toHaveBeenCalled(); - expect(spawnSpy.calls.length).toEqual(3); + expect(spawnSpy.calls.count()).toEqual(3); }).fin(done); }); @@ -302,7 +302,7 @@ describe('PlatformApi polyfill', function () { archs: ['arm', 'x86'], buildConfig: '/some/path' }; - spawnSpy.andReturn(Q()); + spawnSpy.and.returnValue(Q()); platformApi.build(options) .then(function () { ['--release', '--nobuild', '--device', '--target=' + options.target, '--archs=arm,x86', '--buildConfig=' +options.buildConfig] http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b33e222d/cordova-lib/spec-cordova/platforms/platforms.spec.js ---------------------------------------------------------------------- diff --git a/cordova-lib/spec-cordova/platforms/platforms.spec.js b/cordova-lib/spec-cordova/platforms/platforms.spec.js index a1efcf0..9a0e5e8 100644 --- a/cordova-lib/spec-cordova/platforms/platforms.spec.js +++ b/cordova-lib/spec-cordova/platforms/platforms.spec.js @@ -42,7 +42,7 @@ describe('getPlatformApi method', function () { beforeEach(function () { // reset api cache after each spec platforms.__set__('cachedApis', {}); - isCordova = spyOn(util, 'isCordova').andReturn(CORDOVA_ROOT); + isCordova = spyOn(util, 'isCordova').and.returnValue(CORDOVA_ROOT); }); it('should return PlatformApi class defined by platform', function () { @@ -78,7 +78,7 @@ describe('getPlatformApi method', function () { }); it('should throw if called outside of cordova project w/out platformRoot param', function () { - isCordova.andReturn(false); + isCordova.and.returnValue(false); expect(function () { platforms.getPlatformApi('windows'); }).toThrow(); }); http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b33e222d/cordova-lib/spec-cordova/plugin.spec.js ---------------------------------------------------------------------- diff --git a/cordova-lib/spec-cordova/plugin.spec.js b/cordova-lib/spec-cordova/plugin.spec.js index a4f4cd3..3441ce1 100644 --- a/cordova-lib/spec-cordova/plugin.spec.js +++ b/cordova-lib/spec-cordova/plugin.spec.js @@ -146,7 +146,7 @@ describe('plugin end-to-end', function() { expect(errorHandler.errorCallback).not.toHaveBeenCalled(); }); - it('should successfully add and remove a plugin with no options', function(done) { + it('Test 001 : should successfully add and remove a plugin with no options', function(done) { addPlugin(path.join(pluginsDir, 'fake1'), pluginId, {}, done) .then(function() { return removePlugin(pluginId); @@ -158,11 +158,11 @@ describe('plugin end-to-end', function() { .fin(done); }, 30000); - it('should run prepare after plugin installation/removal by default', function(done) { + it('Test 002 : should run prepare after plugin installation/removal by default', function(done) { addPlugin(path.join(pluginsDir, 'fake1'), pluginId, {}) .then(function() { expect(prepare.preparePlatforms).toHaveBeenCalled(); - prepare.preparePlatforms.reset(); + prepare.preparePlatforms.calls.reset(); return removePlugin(pluginId); }) .then(function () { @@ -175,7 +175,7 @@ describe('plugin end-to-end', function() { .fin(done); }, 30000); - it('should not run prepare after plugin installation/removal if platform return non-falsy value', function(done) { + it('Test 003 : should not run prepare after plugin installation/removal if platform return non-falsy value', function(done) { setupPlatformApiSpies(); addPlugin(path.join(pluginsDir, 'fake1'), pluginId, {}) .then(function() { @@ -192,7 +192,7 @@ describe('plugin end-to-end', function() { .fin(done); }, 30000); - it('should successfully add a plugin using relative path when running from subdir inside of project', function(done) { + it('Test 004 : should successfully add a plugin using relative path when running from subdir inside of project', function(done) { // Copy plugin to subdir inside of the project. This is required since path.relative // returns an absolute path when source and dest are on different drives var plugindir = path.join(project, 'custom-plugins/some-plugin-inside-subfolder'); @@ -216,7 +216,7 @@ describe('plugin end-to-end', function() { .fin(done); }, 30000); - it('should respect preference default values', function (done) { + it('Test 005 : should respect preference default values', function (done) { addPlugin(path.join(pluginsDir, org_test_defaultvariables), org_test_defaultvariables, {cli_variables: { REQUIRED:'NO', REQUIRED_ANDROID:'NO'}}, done) .then(function() { var platformJsonPath = path.join(project, 'plugins', helpers.testPlatform + '.json'); @@ -236,7 +236,7 @@ describe('plugin end-to-end', function() { .fin(done); }, 30000); - it('should successfully add a plugin when specifying CLI variables', function(done) { + it('Test 006 : should successfully add a plugin when specifying CLI variables', function(done) { addPlugin(path.join(pluginsDir, org_test_defaultvariables), org_test_defaultvariables, {cli_variables: { REQUIRED:'yes', REQUIRED_ANDROID:'yes'}}, done) .fail(function(err) { console.error(err); @@ -245,15 +245,14 @@ describe('plugin end-to-end', function() { .fin(done); }, 30000); - it('should not check npm info when using the searchpath flag', function(done) { + it('Test 007 : should not check npm info when using the searchpath flag', function(done) { mockPluginFetch(npmInfoTestPlugin, path.join(pluginsDir, npmInfoTestPlugin)); spyOn(registry, 'info'); - addPlugin(npmInfoTestPlugin, npmInfoTestPlugin, {searchpath: pluginsDir}, done) + return addPlugin(npmInfoTestPlugin, npmInfoTestPlugin, {searchpath: pluginsDir}, done) .then(function() { expect(registry.info).not.toHaveBeenCalled(); - - var fetchOptions = plugman.raw.fetch.mostRecentCall.args[2]; - expect(fetchOptions.searchpath).toExist(); + var fetchOptions = plugman.raw.fetch.calls.mostRecent().args[2]; + expect(fetchOptions.searchpath[0]).toExist(); }) .fail(function(err) { console.error(err); @@ -262,7 +261,7 @@ describe('plugin end-to-end', function() { .fin(done); }, 30000); - it('should not check npm info when using the noregistry flag', function(done) { + it('Test 008 : should not check npm info when using the noregistry flag', function(done) { mockPluginFetch(npmInfoTestPlugin, path.join(pluginsDir, npmInfoTestPlugin)); spyOn(registry, 'info'); @@ -270,7 +269,7 @@ describe('plugin end-to-end', function() { .then(function() { expect(registry.info).not.toHaveBeenCalled(); - var fetchOptions = plugman.raw.fetch.mostRecentCall.args[2]; + var fetchOptions = plugman.raw.fetch.calls.mostRecent().args[2]; expect(fetchOptions.noregistry).toBeTruthy(); }) .fail(function(err) { @@ -280,7 +279,7 @@ describe('plugin end-to-end', function() { .fin(done); }, 30000); - it('should not check npm info when fetching from a Git repository', function(done) { + it('Test 009 : should not check npm info when fetching from a Git repository', function(done) { spyOn(registry, 'info'); addPlugin(testGitPluginRepository, testGitPluginId, {}, done) .then(function() { @@ -293,7 +292,7 @@ describe('plugin end-to-end', function() { .fin(done); }, 30000); - it('should select the plugin version based on npm info when fetching from npm', function(done) { + it('Test 010 : should select the plugin version based on npm info when fetching from npm', function(done) { mockPluginFetch(npmInfoTestPlugin, path.join(pluginsDir, npmInfoTestPlugin)); spyOn(registry, 'info').and.callThrough(); @@ -301,7 +300,7 @@ describe('plugin end-to-end', function() { .then(function() { expect(registry.info).toHaveBeenCalled(); - var fetchTarget = plugman.raw.fetch.mostRecentCall.args[0]; + var fetchTarget = plugman.raw.fetch.calls.mostRecent().args[0]; expect(fetchTarget).toEqual(npmInfoTestPlugin + '@' + npmInfoTestPluginVersion); }) .fail(function(err) { @@ -311,7 +310,7 @@ describe('plugin end-to-end', function() { .fin(done); }, 30000); - it('should handle scoped npm packages', function(done) { + it('Test 011 : should handle scoped npm packages', function(done) { var scopedPackage = '@testscope/' + npmInfoTestPlugin; mockPluginFetch(npmInfoTestPlugin, path.join(pluginsDir, npmInfoTestPlugin)); @@ -323,7 +322,7 @@ describe('plugin end-to-end', function() { expect(registry.info).toHaveBeenCalledWith([scopedPackage]); - var fetchTarget = plugman.raw.fetch.mostRecentCall.args[0]; + var fetchTarget = plugman.raw.fetch.calls.mostRecent().args[0]; expect(fetchTarget).toEqual(scopedPackage); }) .fail(function(err) { @@ -333,7 +332,7 @@ describe('plugin end-to-end', function() { .fin(done); }, 30000); - it('should handle scoped npm packages with given version tags', function(done) { + it('Test 012 : should handle scoped npm packages with given version tags', function(done) { var scopedPackage = '@testscope/' + npmInfoTestPlugin + '@latest'; mockPluginFetch(npmInfoTestPlugin, path.join(pluginsDir, npmInfoTestPlugin)); @@ -342,7 +341,7 @@ describe('plugin end-to-end', function() { .then(function() { expect(registry.info).not.toHaveBeenCalled(); - var fetchTarget = plugman.raw.fetch.mostRecentCall.args[0]; + var fetchTarget = plugman.raw.fetch.calls.mostRecent().args[0]; expect(fetchTarget).toEqual(scopedPackage); }) .fail(function(err) { http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b33e222d/cordova-lib/spec-cordova/plugin_fetch.spec.js ---------------------------------------------------------------------- diff --git a/cordova-lib/spec-cordova/plugin_fetch.spec.js b/cordova-lib/spec-cordova/plugin_fetch.spec.js index b1507ef..e1d58cc 100644 --- a/cordova-lib/spec-cordova/plugin_fetch.spec.js +++ b/cordova-lib/spec-cordova/plugin_fetch.spec.js @@ -176,7 +176,7 @@ describe('plugin fetching version selection', function() { getVersionErrorCallback = jasmine.createSpy('unexpectedPluginFetchErrorCallback'); }); - it('should handle a mix of upper bounds and single versions', function(done) { + it('Test 001 : should handle a mix of upper bounds and single versions', function(done) { var testEngine = { '0.0.0' : { 'cordova-android': '1.0.0' }, '0.0.2' : { 'cordova-android': '>1.0.0' }, @@ -194,7 +194,7 @@ describe('plugin fetching version selection', function() { done(); }); - it('should apply upper bound engine constraints when there are no unspecified constraints above the upper bound', function(done) { + it('Test 002 : should apply upper bound engine constraints when there are no unspecified constraints above the upper bound', function(done) { var testEngine = { '1.0.0' : { 'cordova-android': '>2.0.0' }, '1.7.0' : { 'cordova-android': '>4.0.0' }, @@ -212,7 +212,7 @@ describe('plugin fetching version selection', function() { done(); }); - it('should apply upper bound engine constraints when there are unspecified constraints above the upper bound', function(done) { + it('Test 003 : should apply upper bound engine constraints when there are unspecified constraints above the upper bound', function(done) { var testEngine = { '0.0.0' : {}, '2.0.0' : { 'cordova-android': '~5.0.0' }, @@ -226,7 +226,7 @@ describe('plugin fetching version selection', function() { done(); }); - it('should handle the case where there are no constraints for earliest releases', function(done) { + it('Test 004 : should handle the case where there are no constraints for earliest releases', function(done) { var testEngine = { '1.0.0' : { 'cordova-android': '~5.0.0' } }; @@ -238,7 +238,7 @@ describe('plugin fetching version selection', function() { done(); }); - it('should handle the case where the lowest version is unsatisfied', function(done) { + it('Test 005 : should handle the case where the lowest version is unsatisfied', function(done) { var testEngine = { '0.0.2' : { 'cordova-android': '~5.0.0' } }; @@ -250,7 +250,7 @@ describe('plugin fetching version selection', function() { done(); }); - it('should handle upperbounds if no single version constraints are given', function(done) { + it('Test 006 : should handle upperbounds if no single version constraints are given', function(done) { var testEngine = { '<1.0.0': { 'cordova-android': '<2.0.0' } }; @@ -261,7 +261,7 @@ describe('plugin fetching version selection', function() { done(); }); - it('should apply upper bounds greater than highest version', function(done) { + it('Test 007 : should apply upper bounds greater than highest version', function(done) { var testEngine = { '0.0.0' : {}, '<5.0.0': { 'cordova-android': '<2.0.0' } @@ -275,7 +275,7 @@ describe('plugin fetching version selection', function() { done(); }); - it('should treat empty constraints as satisfied', function(done) { + it('Test 008 : should treat empty constraints as satisfied', function(done) { var testEngine = { '1.0.0' : {}, '1.1.0' : { 'cordova-android': '>5.0.0' } @@ -289,7 +289,7 @@ describe('plugin fetching version selection', function() { done(); }); - it('should ignore an empty cordovaDependencies entry', function(done) { + it('Test 009 : should ignore an empty cordovaDependencies entry', function(done) { var testEngine = {}; var after = getWarningCheckCallback(done, []); @@ -298,7 +298,7 @@ describe('plugin fetching version selection', function() { done(); }); - it('should ignore a badly formatted semver range', function(done) { + it('Test 010 : should ignore a badly formatted semver range', function(done) { var testEngine = { '1.1.3' : { 'cordova-android': 'badSemverRange' } }; @@ -309,7 +309,7 @@ describe('plugin fetching version selection', function() { done(); }); - it('should respect unreleased versions in constraints', function(done) { + it('Test 011 : should respect unreleased versions in constraints', function(done) { var testEngine = { '1.0.0' : { 'cordova-android': '3.1.0' }, '1.1.2' : { 'cordova-android': '6.0.0' }, @@ -324,7 +324,7 @@ describe('plugin fetching version selection', function() { done(); }); - it('should respect plugin constraints', function(done) { + it('Test 012 : should respect plugin constraints', function(done) { var testEngine = { '0.0.0' : { 'ca.filmaj.AndroidPlugin': '1.2.0' }, '1.1.3' : { 'ca.filmaj.AndroidPlugin': '<5.0.0 || >2.3.0' }, @@ -339,7 +339,7 @@ describe('plugin fetching version selection', function() { done(); }); - it('should respect cordova constraints', function(done) { + it('Test 013 : should respect cordova constraints', function(done) { var testEngine = { '0.0.0' : { 'cordova': '>1.0.0' }, '1.1.3' : { 'cordova': '<3.0.0 || >4.0.0' }, @@ -354,7 +354,7 @@ describe('plugin fetching version selection', function() { done(); }); - it('should not include pre-release versions', function(done) { + it('Test 014 : should not include pre-release versions', function(done) { var testEngine = { '0.0.0' : {}, '2.0.0' : { 'cordova-android': '>5.0.0' } @@ -369,7 +369,7 @@ describe('plugin fetching version selection', function() { done(); }); - it('should not fail if there is no engine in the npm info', function(done) { + it('Test 015 : should not fail if there is no engine in the npm info', function(done) { plugin.getFetchVersion(project, { version: '2.3.0', name: 'test-plugin', @@ -381,7 +381,7 @@ describe('plugin fetching version selection', function() { .fail(getVersionErrorCallback).fin(done); }); - it('should not fail if there is no cordovaDependencies in the engines', function(done) { + it('Test 016 : should not fail if there is no cordovaDependencies in the engines', function(done) { var after = getWarningCheckCallback(done, []); plugin.getFetchVersion(project, { @@ -400,7 +400,7 @@ describe('plugin fetching version selection', function() { done(); }); - it('should handle extra whitespace', function(done) { + it('Test 017 : should handle extra whitespace', function(done) { var testEngine = { ' 1.0.0 ' : {}, '2.0.0 ' : { ' cordova-android': '~5.0.0 ' }, @@ -415,7 +415,7 @@ describe('plugin fetching version selection', function() { done(); }); - it('should ignore badly typed version requirement entries', function(done) { + it('Test 018 : should ignore badly typed version requirement entries', function(done) { var testEngine = { '1.1.0' : ['cordova', '5.0.0'], '1.3.0' : undefined, @@ -428,7 +428,7 @@ describe('plugin fetching version selection', function() { done(); }); - it('should ignore badly typed constraint entries', function(done) { + it('Test 019 : should ignore badly typed constraint entries', function(done) { var testEngine = { '0.0.2' : { 'cordova': 1 }, '0.7.0' : { 'cordova': {}}, @@ -444,7 +444,7 @@ describe('plugin fetching version selection', function() { done(); }); - it('should ignore bad semver versions', function(done) { + it('Test 020 : should ignore bad semver versions', function(done) { var testEngine = { '0.0.0' : { 'cordova-android': '5.0.0' }, 'notAVersion' : { 'cordova-android': '3.1.0' }, @@ -462,7 +462,7 @@ describe('plugin fetching version selection', function() { done(); }); - it('should not fail if there are bad semver versions', function(done) { + it('Test 021 : should not fail if there are bad semver versions', function(done) { var testEngine = { 'notAVersion' : { 'cordova-android': '3.1.0' }, '^1.1.2' : { 'cordova-android': '3.1.0' }, @@ -481,7 +481,7 @@ describe('plugin fetching version selection', function() { done(); }); - it('should properly warn about multiple unmet requirements', function(done) { + it('Test 022 : should properly warn about multiple unmet requirements', function(done) { var testEngine = { '1.7.0' : { 'cordova-android' : '>5.1.0', @@ -498,7 +498,7 @@ describe('plugin fetching version selection', function() { done(); }); - it('should properly warn about both unmet latest and upper bound requirements', function(done) { + it('Test 023 : should properly warn about both unmet latest and upper bound requirements', function(done) { var testEngine = { '1.7.0' : { 'cordova-android': '>5.1.0' }, '<5.0.0': { @@ -515,7 +515,7 @@ describe('plugin fetching version selection', function() { done(); }); - it('should not warn about versions past latest', function(done) { + it('Test 024 : should not warn about versions past latest', function(done) { var testEngine = { '1.7.0' : { 'cordova-android': '>5.1.0' }, '7.0.0': { @@ -531,7 +531,7 @@ describe('plugin fetching version selection', function() { done(); }); - it('clean up after plugin fetch spec', function() { + it('Test 025 : clean up after plugin fetch spec', function() { removeTestProject(); }); }); http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b33e222d/cordova-lib/spec-cordova/plugin_package_parse.spec.js ---------------------------------------------------------------------- diff --git a/cordova-lib/spec-cordova/plugin_package_parse.spec.js b/cordova-lib/spec-cordova/plugin_package_parse.spec.js index 7d99e2e..3ae1ca5 100644 --- a/cordova-lib/spec-cordova/plugin_package_parse.spec.js +++ b/cordova-lib/spec-cordova/plugin_package_parse.spec.js @@ -29,21 +29,21 @@ describe('methods for parsing npm plugin packages', function() { expect(parsedSpec.package).toEqual(scope ? scope + id : id); } - it('should handle package names with no scope or version', function() { + it('Test 001 : should handle package names with no scope or version', function() { checkPluginSpecParsing('test-plugin', null, 'test-plugin', null); }); - it('should handle package names with a version', function() { + it('Test 002 : should handle package names with a version', function() { checkPluginSpecParsing('test-plugin@1.0.0', null, 'test-plugin', '1.0.0'); checkPluginSpecParsing('test-plugin@latest', null, 'test-plugin', 'latest'); }); - it('should handle package names with a scope', function() { + it('Test 003 : should handle package names with a scope', function() { checkPluginSpecParsing('@test/test-plugin', '@test/', 'test-plugin', null); }); - it('should handle package names with a scope and a version', function() { + it('Test 004 : should handle package names with a scope and a version', function() { checkPluginSpecParsing('@test/test-plugin@1.0.0', '@test/', 'test-plugin', '1.0.0'); checkPluginSpecParsing('@test/test-plugin@latest', '@test/', 'test-plugin', 'latest'); }); - it('should handle invalid package specs', function() { + it('Test 005 : should handle invalid package specs', function() { checkPluginSpecParsing('@nonsense', null, null, null); checkPluginSpecParsing('@/nonsense', null, null, null); checkPluginSpecParsing('@', null, null, null); http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b33e222d/cordova-lib/spec-cordova/plugin_parser.spec.js ---------------------------------------------------------------------- diff --git a/cordova-lib/spec-cordova/plugin_parser.spec.js b/cordova-lib/spec-cordova/plugin_parser.spec.js index f20d311..d5c9007 100644 --- a/cordova-lib/spec-cordova/plugin_parser.spec.js +++ b/cordova-lib/spec-cordova/plugin_parser.spec.js @@ -29,7 +29,7 @@ describe('plugin.xml parser', function () { readfile = spyOn(fs, 'readFileSync').and.returnValue(xml_contents); }); - it('should read a proper plugin.xml file', function() { + it('Test 001 : should read a proper plugin.xml file', function() { var cfg; expect(function () { cfg = new plugin_parser(xml); @@ -37,7 +37,7 @@ describe('plugin.xml parser', function () { expect(cfg).toBeDefined(); expect(cfg.doc).toBeDefined(); }); - it('should be able to figure out which platforms the plugin supports', function() { + it('Test 002 : should be able to figure out which platforms the plugin supports', function() { var cfg = new plugin_parser(xml); expect(cfg.platforms.length).toBe(1); expect(cfg.platforms.indexOf('ios') > -1).toBe(true); http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b33e222d/cordova-lib/spec-cordova/prepare.spec.js ---------------------------------------------------------------------- diff --git a/cordova-lib/spec-cordova/prepare.spec.js b/cordova-lib/spec-cordova/prepare.spec.js index a43dfb0..2ac7850 100644 --- a/cordova-lib/spec-cordova/prepare.spec.js +++ b/cordova-lib/spec-cordova/prepare.spec.js @@ -32,7 +32,6 @@ var shell = require('shelljs'), var project_dir = '/some/path'; var supported_platforms = Object.keys(platforms).filter(function(p) { return p != 'www'; }); -var supported_platforms_paths = supported_platforms.map(function(p) { return path.join(project_dir, 'platforms', p, 'www'); }); var TEST_XML = '<?xml version="1.0" encoding="UTF-8"?>\n' + '<widget xmlns = "http://www.w3.org/ns/widgets"\n' + @@ -92,7 +91,7 @@ describe('prepare command', function() { }); describe('failure', function() { - it('should not run outside of a cordova-based project by calling util.isCordova', function(done) { + it('Test 001 : should not run outside of a cordova-based project by calling util.isCordova', function(done) { is_cordova.and.returnValue(false); cd_project_root.and.callThrough(); // undo spy here because prepare depends on cdprojectRoot for isCordova check prepare().then(function() { @@ -101,7 +100,7 @@ describe('prepare command', function() { expect('' + err).toContain('Current working directory is not a Cordova-based project.'); }).fin(done); }); - it('should not run inside a cordova-based project with no platforms', function(done) { + it('Test 002 : should not run inside a cordova-based project with no platforms', function(done) { list_platforms.and.returnValue([]); prepare().then(function() { expect('this call').toBe('fail'); @@ -112,14 +111,14 @@ describe('prepare command', function() { }); describe('success', function() { - it('should run inside a Cordova-based project by calling util.isCordova', function(done) { + it('Test 003 : should run inside a Cordova-based project by calling util.isCordova', function(done) { prepare().then(function() { expect(is_cordova).toHaveBeenCalled(); }, function(err) { expect(err).toBeUndefined(); }).fin(done); }); - it('should get PlatformApi instance for each platform and invoke its\' run method', function(done) { + it('Test 004 : should get PlatformApi instance for each platform and invoke its\' run method', function(done) { prepare().then(function() { supported_platforms.forEach(function(p) { expect(parsers[p]).toHaveBeenCalled(); @@ -134,16 +133,46 @@ describe('prepare command', function() { describe('hooks', function() { describe('when platforms are added', function() { - it('should fire before hooks through the hooker module, and pass in platforms and paths as data object', function(done) { + it('Test 005 : should fire before hooks through the hooker module, and pass in platforms and paths as data object', function(done) { prepare().then(function() { - expect(fire).toHaveBeenCalledWith('before_prepare', {verbose: false, platforms:supported_platforms, options: [], save: false, fetch: false, paths:supported_platforms_paths}); + expect(fire.calls.argsFor(0)).toEqual( + [ 'before_prepare', + { verbose: false, + platforms: + [ 'ios', + 'osx', + 'android', + 'ubuntu', + 'amazon-fireos', + 'wp8', + 'blackberry10', + 'firefoxos', + 'windows', + 'webos', + 'browser' ], + options: {}, + save: false, + fetch: false, + paths: + [ '/some/path/platforms/ios/www', + '/some/path/platforms/osx/www', + '/some/path/platforms/android/www', + '/some/path/platforms/ubuntu/www', + '/some/path/platforms/amazon-fireos/www', + '/some/path/platforms/wp8/www', + '/some/path/platforms/blackberry10/www', + '/some/path/platforms/firefoxos/www', + '/some/path/platforms/windows/www', + '/some/path/platforms/webos/www', + '/some/path/platforms/browser/www' ], + searchpath: undefined } ]); }, function(err) { expect(err).toBeUndefined(); }).fin(done); }); - it('should fire after hooks through the hooker module, and pass in platforms and paths as data object', function(done) { + it('Test 006 : should fire after hooks through the hooker module, and pass in platforms and paths as data object', function(done) { prepare('android').then(function() { - expect(fire).toHaveBeenCalledWith('after_prepare', {verbose: false, platforms:['android'], options: [], paths:[path.join(project_dir, 'platforms', 'android', 'www')]}); + expect(fire.calls.argsFor(1)).toEqual([ 'after_prepare',{ platforms: [ 'android' ],verbose: false,options: {},paths: [ '/some/path/platforms/android/www' ],searchpath: undefined } ]); }, function(err) { expect(err).toBeUndefined('Exception while running `prepare android`:\n' + err.stack); }).fin(done); @@ -154,7 +183,7 @@ describe('prepare command', function() { beforeEach(function() { list_platforms.and.returnValue([]); }); - it('should not fire the hooker', function(done) { + it('Test 007 : should not fire the hooker', function(done) { Q().then(prepare).then(function() { expect('this call').toBe('fail'); }, function(err) { http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b33e222d/cordova-lib/spec-cordova/project-metadata-apis.spec.js ---------------------------------------------------------------------- diff --git a/cordova-lib/spec-cordova/project-metadata-apis.spec.js b/cordova-lib/spec-cordova/project-metadata-apis.spec.js index ae33c50..ef2bfca 100644 --- a/cordova-lib/spec-cordova/project-metadata-apis.spec.js +++ b/cordova-lib/spec-cordova/project-metadata-apis.spec.js @@ -23,7 +23,7 @@ var cordova = require('../src/cordova/cordova'), describe('retrieval of project metadata', function () { var projectRoot = path.resolve(__dirname, 'Projects/ProjectMetadata'); - it('retrieve platforms saved in config.xml', function (done) { + it('Test 001 : retrieve platforms saved in config.xml', function (done) { var androidVersion = '3.7.1'; var browserSrc = 'https://github.com/apache/cordova-browser.git'; @@ -45,7 +45,7 @@ describe('retrieval of project metadata', function () { }).finally(done); }); - it('retrieve plugins saved in config.xml', function (done) { + it('Test 002 : retrieve plugins saved in config.xml', function (done) { var deviceId = 'org.apache.cordova.device'; var deviceVersion = '0.3.0'; http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b33e222d/cordova-lib/spec-cordova/run.spec.js ---------------------------------------------------------------------- diff --git a/cordova-lib/spec-cordova/run.spec.js b/cordova-lib/spec-cordova/run.spec.js index 43b6b79..18e3fdd 100644 --- a/cordova-lib/spec-cordova/run.spec.js +++ b/cordova-lib/spec-cordova/run.spec.js @@ -42,7 +42,7 @@ describe('run 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([]); Q().then(cordova.raw.run).then(function() { expect('this call').toBe('fail'); @@ -50,7 +50,7 @@ describe('run command', function() { expect(err.message).toEqual('No platforms added to this project. Please use `cordova platform add <platform>`.'); }).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) { var msg = 'Dummy message about not being in a cordova dir.'; cd_project_root.and.throwError(new Error(msg)); is_cordova.and.returnValue(false); @@ -63,14 +63,14 @@ describe('run command', function() { }); describe('success', function() { - it('should call prepare before actually run platform ', function(done) { + it('Test 003 : should call prepare before actually run platform ', function(done) { cordova.raw.run(['android','ios']).then(function() { - expect(prepare_spy).toHaveBeenCalledWith({ platforms: [ 'android', 'ios' ], verbose: false, options: [] }); + expect(prepare_spy.calls.argsFor(0)).toEqual([ { platforms: [ 'android', 'ios' ], verbose: false, options: {} } ]); }, function(err) { expect(err).toBeUndefined(); }).fin(done); }); - it('should get PlatformApi instance for each platform and call its\' run method', function(done) { + it('Test 004 : should get PlatformApi instance for each platform and call its\' run method', function(done) { cordova.raw.run(['android','ios']).then(function() { expect(getPlatformApi).toHaveBeenCalledWith('android'); expect(getPlatformApi).toHaveBeenCalledWith('ios'); @@ -80,7 +80,7 @@ describe('run command', function() { expect(err).toBeUndefined(); }).fin(done); }); - it('should pass down parameters', function(done) { + it('Test 005 : should pass down parameters', function(done) { cordova.raw.run({platforms: ['blackberry10'], options:{password: '1q1q'}}).then(function() { expect(prepare_spy).toHaveBeenCalledWith({ platforms: [ 'blackberry10' ], options: { password: '1q1q' }, verbose: false }); expect(platformApi.build).toHaveBeenCalledWith({password: '1q1q'}); @@ -89,7 +89,7 @@ describe('run command', function() { expect(err).toBeUndefined(); }).fin(done); }); - it('should convert parameters from old format and warn user about this', function (done) { + it('Test 006 : should convert parameters 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'); } @@ -108,7 +108,7 @@ describe('run command', function() { }); }); - it('should call platform\'s build method', function (done) { + it('Test 007 : should call platform\'s build method', function (done) { cordova.raw.run({platforms: ['blackberry10']}) .then(function() { expect(prepare_spy).toHaveBeenCalled(); @@ -120,7 +120,7 @@ describe('run 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.run({platforms: ['blackberry10'], options: { nobuild: true }}) .then(function() { expect(prepare_spy).toHaveBeenCalled(); @@ -144,7 +144,7 @@ describe('run command', function() { afterEach(function() { platformApi.build = originalBuildSpy; }); - it('should leave parameters unchanged', function(done) { + it('Test 009 : 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'}); @@ -158,16 +158,16 @@ describe('run command', function() { describe('hooks', function() { describe('when platforms are added', function() { - it('should fire before hooks through the hooker module', function(done) { + it('Test 010 : should fire before hooks through the hooker module', function(done) { cordova.raw.run(['android', 'ios']).then(function() { - expect(fire).toHaveBeenCalledWith('before_run', {verbose: false, platforms:['android', 'ios'], options: []}); + expect(fire.calls.argsFor(0)).toEqual([ 'before_run', { platforms: [ 'android', 'ios' ], verbose: false, options: {} } ]); }, function(err) { expect(err).toBeUndefined(); }).fin(done); }); - it('should fire after hooks through the hooker module', function(done) { + it('Test 011 : should fire after hooks through the hooker module', function(done) { cordova.raw.run('android').then(function() { - expect(fire).toHaveBeenCalledWith('after_run', {verbose: false, platforms:['android'], options: []}); + expect(fire.calls.argsFor(2)).toEqual([ 'after_run', { platforms: [ 'android' ], verbose: false, options: {} } ]); }, function(err) { expect(err).toBeUndefined(); }).fin(done); @@ -175,7 +175,7 @@ describe('run command', function() { }); describe('with no platforms added', function() { - it('should not fire the hooker', function(done) { + it('Test 012 : should not fire the hooker', function(done) { list_platforms.and.returnValue([]); Q().then(cordova.raw.run).then(function() { expect('this call').toBe('fail'); --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cordova.apache.org For additional commands, e-mail: commits-h...@cordova.apache.org