You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by au...@apache.org on 2017/07/14 22:57:46 UTC
[6/7] cordova-windows git commit: CB-12895 : setup eslint and removed
jshint
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/a8692238/spec/unit/Prepare.Win10.spec.js
----------------------------------------------------------------------
diff --git a/spec/unit/Prepare.Win10.spec.js b/spec/unit/Prepare.Win10.spec.js
index 977c0bc..847ed01 100644
--- a/spec/unit/Prepare.Win10.spec.js
+++ b/spec/unit/Prepare.Win10.spec.js
@@ -17,29 +17,29 @@
under the License.
*/
-var rewire = require('rewire'),
- prepare = rewire('../../template/cordova/lib/prepare'),
- AppxManifest = require('../../template/cordova/lib/AppxManifest'),
- ConfigParser = require('../../template/cordova/lib/ConfigParser'),
- fs = require('fs'),
- et = require('elementtree'),
- events = require('cordova-common').events,
- path = require('path'),
- xml = require('cordova-common').xmlHelpers,
- FileUpdater = require('cordova-common').FileUpdater,
- updateManifestFile = prepare.__get__('updateManifestFile'),
- applyCoreProperties = prepare.__get__('applyCoreProperties'),
- applyAccessRules = prepare.__get__('applyAccessRules'),
- applyNavigationWhitelist = prepare.__get__('applyNavigationWhitelist'),
- applyStartPage = prepare.__get__('applyStartPage');
-
-var Win10ManifestPath = 'template/package.windows10.appxmanifest',
- Win81ManifestPath = 'template/package.windows.appxmanifest',
- WP81ManifestPath = 'template/package.phone.appxmanifest';
-
-var Win10ManifestName = path.basename(Win10ManifestPath),
- Win81ManifestName = path.basename(Win81ManifestPath),
- WP81ManifestName = path.basename(WP81ManifestPath);
+var rewire = require('rewire');
+var prepare = rewire('../../template/cordova/lib/prepare');
+var AppxManifest = require('../../template/cordova/lib/AppxManifest');
+var ConfigParser = require('../../template/cordova/lib/ConfigParser');
+var fs = require('fs');
+var et = require('elementtree');
+var events = require('cordova-common').events;
+var path = require('path');
+var xml = require('cordova-common').xmlHelpers;
+var FileUpdater = require('cordova-common').FileUpdater;
+var updateManifestFile = prepare.__get__('updateManifestFile');
+var applyCoreProperties = prepare.__get__('applyCoreProperties');
+var applyAccessRules = prepare.__get__('applyAccessRules');
+var applyNavigationWhitelist = prepare.__get__('applyNavigationWhitelist');
+var applyStartPage = prepare.__get__('applyStartPage');
+
+var Win10ManifestPath = 'template/package.windows10.appxmanifest';
+var Win81ManifestPath = 'template/package.windows.appxmanifest';
+var WP81ManifestPath = 'template/package.phone.appxmanifest';
+
+var Win10ManifestName = path.basename(Win10ManifestPath);
+var Win81ManifestName = path.basename(Win81ManifestPath);
+var WP81ManifestName = path.basename(WP81ManifestPath);
/***
* Unit tests for validating default ms-appx-web:// URI scheme in Win10
@@ -54,22 +54,22 @@ var PreferencesBaseline = {
WindowsStoreIdentityName: null
};
-function createMockConfigAndManifestForApplyCoreProperties(startPage, preferences, win10, winPackageVersion) {
+function createMockConfigAndManifestForApplyCoreProperties (startPage, preferences, win10, winPackageVersion) {
if (!preferences) {
preferences = { };
}
- /* jshint proto: true */
- preferences.__proto__ = PreferencesBaseline;
- /* jshint proto: false */
+
+ preferences.__proto__ = PreferencesBaseline; /* eslint no-proto: 0 */
+
var config = {
- version: function() { return '1.0.0.0'; },
+ version: function () { return '1.0.0.0'; },
description: function () { return 'CordovaApp'; },
- windows_packageVersion: function() { return winPackageVersion; },
- name: function() { return 'HelloCordova'; },
- packageName: function() { return 'org.apache.cordova.HelloCordova'; },
- author: function() { return 'Apache'; },
- startPage: function() { return startPage; },
- getPreference: function(preferenceName) {
+ windows_packageVersion: function () { return winPackageVersion; },
+ name: function () { return 'HelloCordova'; },
+ packageName: function () { return 'org.apache.cordova.HelloCordova'; },
+ author: function () { return 'Apache'; },
+ startPage: function () { return startPage; },
+ getPreference: function (preferenceName) {
if (typeof preferences[preferenceName] !== 'undefined') {
return preferences[preferenceName];
} else {
@@ -85,16 +85,16 @@ function createMockConfigAndManifestForApplyCoreProperties(startPage, preference
return { config: config, manifest: manifest };
}
-function addCapabilityDeclarationToMockManifest(manifest, capability) {
+function addCapabilityDeclarationToMockManifest (manifest, capability) {
var capRoot = manifest.doc.find('.//Capabilities');
var cap = new et.Element('Capability');
cap.attrib.Name = capability;
capRoot.append(cap);
}
-describe('Windows 8.1 project', function() {
+describe('Windows 8.1 project', function () {
- it('should not have an HTTP or HTTPS scheme for its startup URI.', function() {
+ it('should not have an HTTP or HTTPS scheme for its startup URI.', function () {
// arrange
var mockConfig = createMockConfigAndManifestForApplyCoreProperties('index.html', { 'WindowsDefaultUriPrefix': 'http://' }, false);
@@ -106,7 +106,7 @@ describe('Windows 8.1 project', function() {
expect(app.attrib.StartPage).toBe('www/index.html');
});
- it('should not have any scheme for its startup URI.', function() {
+ it('should not have any scheme for its startup URI.', function () {
// arrange
var mockConfig = createMockConfigAndManifestForApplyCoreProperties('index.html', { 'WindowsDefaultUriPrefix': 'ms-appx://' }, false);
@@ -119,8 +119,8 @@ describe('Windows 8.1 project', function() {
});
});
-describe('Windows 10 project', function() {
- it('should default to ms-appx-web for its startup URI.', function() {
+describe('Windows 10 project', function () {
+ it('should default to ms-appx-web for its startup URI.', function () {
// arrange
var mockConfig = createMockConfigAndManifestForApplyCoreProperties('index.html', { }, true);
@@ -136,7 +136,7 @@ describe('Windows 10 project', function() {
expect(isAppxWebStartupUri).toBe(true);
});
- it ('should allow ms-appx as its startup URI, and it gets removed from the final output.', function() {
+ it('should allow ms-appx as its startup URI, and it gets removed from the final output.', function () {
// arrange
var mockConfig = createMockConfigAndManifestForApplyCoreProperties('index.html', { 'WindowsDefaultUriPrefix': 'ms-appx://' }, true);
@@ -148,7 +148,7 @@ describe('Windows 10 project', function() {
expect(app.attrib.StartPage).toBe('www/index.html');
});
- it('should allow an HTTP or HTTPS scheme for its startup URI.', function() {
+ it('should allow an HTTP or HTTPS scheme for its startup URI.', function () {
// arrange
var mockConfig = createMockConfigAndManifestForApplyCoreProperties('www.contoso.com/', { 'WindowsDefaultUriPrefix': 'http://' }, true);
@@ -161,10 +161,9 @@ describe('Windows 10 project', function() {
});
});
-
describe('Windows Store preference', function () {
- it('"WindowsStoreDisplayName" should be reflected in the manifest.', function() {
+ it('"WindowsStoreDisplayName" should be reflected in the manifest.', function () {
// arrange
var mockConfig = createMockConfigAndManifestForApplyCoreProperties('www.contoso.com/', { 'WindowsDefaultUriPrefix': 'http://', 'WindowsStoreDisplayName': 'ContosoApp' }, true);
@@ -176,7 +175,7 @@ describe('Windows Store preference', function () {
expect(app.text).toBe('ContosoApp');
});
- it('"WindowsStorePublisherName" should be reflected in the manifest.', function() {
+ it('"WindowsStorePublisherName" should be reflected in the manifest.', function () {
// arrange
var mockConfig = createMockConfigAndManifestForApplyCoreProperties('www.contoso.com/', { 'WindowsDefaultUriPrefix': 'http://', 'WindowsStorePublisherName': 'Contoso Inc' }, true);
@@ -189,14 +188,14 @@ describe('Windows Store preference', function () {
});
});
-describe('A Windows 10 project should warn if it supports remote mode and restricted capabilities.', function() {
+describe('A Windows 10 project should warn if it supports remote mode and restricted capabilities.', function () {
// arrange
var mockConfig;
- var stringFound = false,
- searchStr = 'documentsLibrary';
+ var stringFound = false;
+ var searchStr = 'documentsLibrary';
- beforeEach(function() {
+ beforeEach(function () {
mockConfig = createMockConfigAndManifestForApplyAccessRules(true, 'http://www.bing.com/*');
addCapabilityDeclarationToMockManifest(mockConfig.manifest, 'documentsLibrary');
@@ -204,12 +203,11 @@ describe('A Windows 10 project should warn if it supports remote mode and restri
stringFound = false;
events.on('warn', function (msg) {
- if (msg.indexOf(searchStr) >= 0)
- stringFound = true;
+ if (msg.indexOf(searchStr) >= 0) { stringFound = true; }
});
});
- it('asserts that the documentsLibrary capability is restricted', function() {
+ it('asserts that the documentsLibrary capability is restricted', function () {
// act
updateManifestFile(mockConfig.config, '/manifest/path');
@@ -223,7 +221,7 @@ describe('A Windows 10 project should warn if it supports remote mode and restri
* (for the function applyAccessRules) from prepare.js.
**/
-function createMockConfigAndManifestForApplyAccessRules(isWin10) {
+function createMockConfigAndManifestForApplyAccessRules (isWin10) {
var rules = [];
for (var i = 1; i < arguments.length; i++) {
rules.push(arguments[i]);
@@ -242,8 +240,8 @@ function createMockConfigAndManifestForApplyAccessRules(isWin10) {
'</widget>\n';
var origParseElementtreeSync = xml.parseElementtreeSync;
- spyOn(xml, 'parseElementtreeSync').and.callFake(function(path) {
- if (path ==='config.xml') return new et.ElementTree(et.XML(TEST_XML));
+ spyOn(xml, 'parseElementtreeSync').and.callFake(function (path) {
+ if (path === 'config.xml') return new et.ElementTree(et.XML(TEST_XML));
return origParseElementtreeSync(path);
});
@@ -258,7 +256,7 @@ function createMockConfigAndManifestForApplyAccessRules(isWin10) {
return origGetPreference.call(config, prefName);
});
- config.getAccesses = function() {
+ config.getAccesses = function () {
if (isWin10) {
return [];
}
@@ -268,7 +266,7 @@ function createMockConfigAndManifestForApplyAccessRules(isWin10) {
});
};
- config.getAllowNavigations = function() {
+ config.getAllowNavigations = function () {
if (isWin10) {
return rules.map(function (rule) {
return { 'href': rule };
@@ -287,14 +285,14 @@ function createMockConfigAndManifestForApplyAccessRules(isWin10) {
describe('Access rules management', function () {
// body...
- it('A Windows 8.1 project should not have WindowsRuntimeAccess attributes in access rules.', function() {
+ it('A Windows 8.1 project should not have WindowsRuntimeAccess attributes in access rules.', function () {
var mockConfig = createMockConfigAndManifestForApplyAccessRules(false, 'https://www.contoso.com');
applyAccessRules(mockConfig.config, mockConfig.manifest);
- var app = mockConfig.manifest.doc.find('.//Application'),
- accessRules = app.find('.//ApplicationContentUriRules');
+ var app = mockConfig.manifest.doc.find('.//Application');
+ var accessRules = app.find('.//ApplicationContentUriRules');
expect(accessRules).toBeDefined();
expect(accessRules.len()).toBe(1);
@@ -305,14 +303,14 @@ describe('Access rules management', function () {
});
- it('A Windows 10 project should have WindowsRuntimeAccess attributes in access rules.', function() {
+ it('A Windows 10 project should have WindowsRuntimeAccess attributes in access rules.', function () {
var mockConfig = createMockConfigAndManifestForApplyAccessRules(true, 'https://www.contoso.com');
applyNavigationWhitelist(mockConfig.config, mockConfig.manifest, true);
- var app = mockConfig.manifest.doc.find('.//Application'),
- accessRules = app.find('.//uap:ApplicationContentUriRules');
+ var app = mockConfig.manifest.doc.find('.//Application');
+ var accessRules = app.find('.//uap:ApplicationContentUriRules');
expect(accessRules).toBeDefined();
expect(accessRules.len()).toBe(2);
@@ -324,18 +322,18 @@ describe('Access rules management', function () {
});
- describe('A Windows 8.1 project should reject http:// URI scheme rules.', function() {
+ describe('A Windows 8.1 project should reject http:// URI scheme rules.', function () {
- var stringIndex = -1,
- searchStr = 'Access rules must begin with "https://", the following rule will be ignored: ';
+ var stringIndex = -1;
+ var searchStr = 'Access rules must begin with "https://", the following rule will be ignored: ';
- beforeEach(function() {
+ beforeEach(function () {
require('cordova-common').events.on('warn', function (evt) {
stringIndex = evt.indexOf(searchStr);
});
});
- it('applies access rules and verifies at least one was rejected', function() {
+ it('applies access rules and verifies at least one was rejected', function () {
var mockConfig = createMockConfigAndManifestForApplyAccessRules(false, 'http://www.contoso.com');
applyAccessRules(mockConfig.config, mockConfig.manifest, false);
@@ -343,17 +341,17 @@ describe('Access rules management', function () {
});
});
- describe('A Windows 10 project should accept http:// URI access rules.', function() {
+ describe('A Windows 10 project should accept http:// URI access rules.', function () {
- var stringIndex = -1,
- searchStr = 'The following navigation rule had an invalid URI scheme and is ignored:';
- beforeEach(function() {
+ var stringIndex = -1;
+ var searchStr = 'The following navigation rule had an invalid URI scheme and is ignored:';
+ beforeEach(function () {
require('cordova-common').events.on('warn', function (evt) {
stringIndex = evt.indexOf(searchStr);
});
});
- it('applies access rules and verifies they were accepted', function() {
+ it('applies access rules and verifies they were accepted', function () {
var mockConfig = createMockConfigAndManifestForApplyAccessRules(true, 'http://www.contoso.com');
applyAccessRules(mockConfig.config, mockConfig.manifest, true);
@@ -362,11 +360,11 @@ describe('Access rules management', function () {
});
});
-describe('A Windows 10 project should apply the uap: namespace prefix to certain capabilities.', function() {
+describe('A Windows 10 project should apply the uap: namespace prefix to certain capabilities.', function () {
var manifest;
- beforeEach(function() {
+ beforeEach(function () {
manifest = createMockConfigAndManifestForApplyAccessRules(true, 'https://www.contoso.com').manifest;
var element = manifest.doc.find('.//Capabilities');
element.clear();
@@ -376,10 +374,10 @@ describe('A Windows 10 project should apply the uap: namespace prefix to certain
manifest.write();
});
- it('Applies the uap: prefix to the documentsLibrary capability.', function() {
+ it('Applies the uap: prefix to the documentsLibrary capability.', function () {
var testResults = {};
// map capabilities to tag
- manifest.getCapabilities().forEach(function(child) {
+ manifest.getCapabilities().forEach(function (child) {
testResults[child.name] = child.type;
});
@@ -389,19 +387,19 @@ describe('A Windows 10 project should apply the uap: namespace prefix to certain
});
});
-function createMockConfigAndManifestForDescription(description) {
+function createMockConfigAndManifestForDescription (description) {
var config = {
- version: function() { return '1.0.0.0'; },
- name: function() { return 'HelloCordova'; },
+ version: function () { return '1.0.0.0'; },
+ name: function () { return 'HelloCordova'; },
description: function () { return description; },
- packageName: function() { return 'org.apache.cordova.HelloCordova'; },
- author: function() { return 'Apache'; },
- startPage: function() { return 'index.html'; },
- windows_packageVersion: function() { return; },
- getPreference: function () { return; }
+ packageName: function () { return 'org.apache.cordova.HelloCordova'; },
+ author: function () { return 'Apache'; },
+ startPage: function () { return 'index.html'; },
+ windows_packageVersion: function () { },
+ getPreference: function () { }
};
- var manifest = AppxManifest.get(Win81ManifestPath, /*ignoreCache=*/true);
+ var manifest = AppxManifest.get(Win81ManifestPath, /* ignoreCache= */true);
spyOn(fs, 'writeFileSync');
return { config: config, manifest: manifest };
@@ -431,7 +429,7 @@ describe('Package description', function () {
});
it('should be stripped to 2048 symbols before adding to manifest', function () {
- var veryLongDescription = (new Array(3*1024)).join('x');
+ var veryLongDescription = (new Array(3 * 1024)).join('x');
var mockConfig = createMockConfigAndManifestForDescription(veryLongDescription);
expect(function () {
@@ -466,7 +464,7 @@ describe('copyIcons method', function () {
var PROJECT = '/some/path';
- function createMockConfig(images, splashScreens) {
+ function createMockConfig (images, splashScreens) {
var result = jasmine.createSpyObj('config', ['getIcons', 'getSplashScreens']);
result.getIcons.and.returnValue(images);
result.getSplashScreens.and.returnValue(splashScreens || []);
@@ -480,8 +478,8 @@ describe('copyIcons method', function () {
it('should guess target filename based on icon size', function () {
var images = [
- {src: 'res/Windows/Square44x44Logo_100.png', width: '44', height: '44' },
- {src: 'res/Windows/Square44x44Logo_240.png', width: '106', height: '106' }
+ { src: 'res/Windows/Square44x44Logo_100.png', width: '44', height: '44' },
+ { src: 'res/Windows/Square44x44Logo_240.png', width: '106', height: '106' }
];
var project = { projectConfig: createMockConfig(images), root: PROJECT };
@@ -497,7 +495,7 @@ describe('copyIcons method', function () {
it('should ignore unknown icon sizes and emit a warning', function () {
var config = createMockConfig([
- {src: 'res/Windows/UnknownImage.png', width: '999', height: '999' },
+ { src: 'res/Windows/UnknownImage.png', width: '999', height: '999' }
]);
var project = { projectConfig: config, root: PROJECT };
var locations = { root: PROJECT };
@@ -526,7 +524,7 @@ describe('copyIcons method', function () {
spyOn(fs, 'readdirSync').and.returnValue(matchingFiles.concat(nonMatchingFiles));
- var images = [{src: 'res/Windows/Square44x44.png', target: 'SmallIcon' }];
+ var images = [{ src: 'res/Windows/Square44x44.png', target: 'SmallIcon' }];
var project = { projectConfig: createMockConfig(images), root: PROJECT };
var locations = { root: PROJECT };
@@ -535,7 +533,7 @@ describe('copyIcons method', function () {
var expectedPathMap = {};
expectedPathMap[path.join('images', 'SmallIcon.scale-100.png')] =
path.join('res', 'Windows', 'Square44x44.scale-100.png');
- expectedPathMap[path.join('images','SmallIcon.targetsize-16.png')] =
+ expectedPathMap[path.join('images', 'SmallIcon.targetsize-16.png')] =
path.join('res', 'Windows', 'Square44x44.targetsize-16.png');
expectedPathMap[path.join('images', 'SmallIcon.scale-150_targetsize-16.png')] =
path.join('res', 'Windows', 'Square44x44.scale-150_targetsize-16.png');
@@ -553,15 +551,15 @@ describe('copyIcons method', function () {
events.on('warn', warnSpy);
var splashScreens = [
- {src: 'res/Windows/splashscreen.png', target: 'SplashScreen' }, // targetProject: 10
- {src: 'res/Windows/splashscreen.scale-180.png', width: '1116', height: '540' }, // targetProject: 8.1
- {src: 'res/Windows/splashscreen.scale-200.png', width: '1240', height: '600' }, // targetProject: 10
- {src: 'res/Windows/splashscreen.scale-400.png', width: '2480', height: '1200' }, // targetProject: 10
- {src: 'res/Windows/splashscreenphone.scale-240.png', width: '1152', height: '1920' }, // targetProject: WP 8.1
- {src: 'res/Windows/splashscreenphone.png', target: 'SplashScreenPhone' }, // targetProject: WP 8.1
+ { src: 'res/Windows/splashscreen.png', target: 'SplashScreen' }, // targetProject: 10
+ { src: 'res/Windows/splashscreen.scale-180.png', width: '1116', height: '540' }, // targetProject: 8.1
+ { src: 'res/Windows/splashscreen.scale-200.png', width: '1240', height: '600' }, // targetProject: 10
+ { src: 'res/Windows/splashscreen.scale-400.png', width: '2480', height: '1200' }, // targetProject: 10
+ { src: 'res/Windows/splashscreenphone.scale-240.png', width: '1152', height: '1920' }, // targetProject: WP 8.1
+ { src: 'res/Windows/splashscreenphone.png', target: 'SplashScreenPhone' } // targetProject: WP 8.1
];
- var splashScreensFiles = splashScreens.map(function(splash) {
+ var splashScreensFiles = splashScreens.map(function (splash) {
return path.basename(splash.src);
});
spyOn(fs, 'readdirSync').and.returnValue(splashScreensFiles);
@@ -588,12 +586,12 @@ describe('copyIcons method', function () {
events.on('warn', warnSpy);
var splashScreens = [
- {src: 'res/Windows/splashscreen.gif', target: 'SplashScreen' }, // targetProject: 10
- {src: 'res/Windows/splashscreen.scale-180.bmp', width: '1116', height: '540' }, // targetProject: 8.1
- {src: 'res/Windows/splashscreenphone.tga', target: 'SplashScreenPhone' }, // targetProject: WP 8.1
+ { src: 'res/Windows/splashscreen.gif', target: 'SplashScreen' }, // targetProject: 10
+ { src: 'res/Windows/splashscreen.scale-180.bmp', width: '1116', height: '540' }, // targetProject: 8.1
+ { src: 'res/Windows/splashscreenphone.tga', target: 'SplashScreenPhone' } // targetProject: WP 8.1
];
- var splashScreensFiles = splashScreens.map(function(splash) {
+ var splashScreensFiles = splashScreens.map(function (splash) {
return path.basename(splash.src);
});
spyOn(fs, 'readdirSync').and.returnValue(splashScreensFiles);
@@ -619,29 +617,29 @@ describe('copyIcons method', function () {
var updateSplashScreenImageExtensions = prepare.__get__('updateSplashScreenImageExtensions');
spyOn(fs, 'writeFileSync');
spyOn(AppxManifest, 'get').and.returnValue({
- getVisualElements: function() {
+ getVisualElements: function () {
return {
- getSplashScreenExtension: function() {
+ getSplashScreenExtension: function () {
return '.png';
},
- setSplashScreenExtension: function() {}
+ setSplashScreenExtension: function () {}
};
},
- write: function() {}
+ write: function () {}
});
var warnSpy = jasmine.createSpy('warn');
events.on('warn', warnSpy);
var splashScreens = [
- {src: 'res/Windows/splashscreen.png', width: '620', height: '300' }, // targetProject: 10
- {src: 'res/Windows/splashscreen.scale-180.jpg', width: '1116', height: '540' }, // targetProject: 8.1
- {src: 'res/Windows/splashscreen.scale-200.png', width: '1240', height: '600' }, // targetProject: 10
- {src: 'res/Windows/splashscreen.scale-400.jpg', width: '2480', height: '1200' }, // targetProject: 10
- {src: 'res/Windows/splashscreenphone.scale-240.png', width: '1152', height: '1920' }, // targetProject: WP 8.1
- {src: 'res/Windows/splashscreenphone.jpg', width: '480', height: '800' }, // targetProject: WP 8.1
+ { src: 'res/Windows/splashscreen.png', width: '620', height: '300' }, // targetProject: 10
+ { src: 'res/Windows/splashscreen.scale-180.jpg', width: '1116', height: '540' }, // targetProject: 8.1
+ { src: 'res/Windows/splashscreen.scale-200.png', width: '1240', height: '600' }, // targetProject: 10
+ { src: 'res/Windows/splashscreen.scale-400.jpg', width: '2480', height: '1200' }, // targetProject: 10
+ { src: 'res/Windows/splashscreenphone.scale-240.png', width: '1152', height: '1920' }, // targetProject: WP 8.1
+ { src: 'res/Windows/splashscreenphone.jpg', width: '480', height: '800' } // targetProject: WP 8.1
];
- var splashScreensFiles = splashScreens.map(function(splash) {
+ var splashScreensFiles = splashScreens.map(function (splash) {
return path.basename(splash.src);
});
spyOn(fs, 'readdirSync').and.returnValue(splashScreensFiles);
@@ -668,11 +666,11 @@ describe('copyIcons method', function () {
var updateSplashScreenImageExtensions = prepare.__get__('updateSplashScreenImageExtensions');
spyOn(fs, 'writeFileSync');
- var win10Manifest = AppxManifest.get(Win10ManifestPath),
- win81Manifest = AppxManifest.get(Win81ManifestPath),
- wp81Manifest = AppxManifest.get(WP81ManifestPath);
+ var win10Manifest = AppxManifest.get(Win10ManifestPath);
+ var win81Manifest = AppxManifest.get(Win81ManifestPath);
+ var wp81Manifest = AppxManifest.get(WP81ManifestPath);
- spyOn(AppxManifest, 'get').and.callFake(function(manifestPath) {
+ spyOn(AppxManifest, 'get').and.callFake(function (manifestPath) {
if (manifestPath.indexOf(Win10ManifestName) !== -1) {
return win10Manifest;
}
@@ -687,12 +685,12 @@ describe('copyIcons method', function () {
});
var splashScreens = [
- {src: 'res/Windows/splashscreen.jpg', width: '620', height: '300' }, // targetProject: 10
- {src: 'res/Windows/splashscreen.scale-180.jpg', width: '1116', height: '540' }, // targetProject: 8.1
- {src: 'res/Windows/splashscreenphone.jpg', width: '480', height: '800' }, // targetProject: WP 8.1
+ { src: 'res/Windows/splashscreen.jpg', width: '620', height: '300' }, // targetProject: 10
+ { src: 'res/Windows/splashscreen.scale-180.jpg', width: '1116', height: '540' }, // targetProject: 8.1
+ { src: 'res/Windows/splashscreenphone.jpg', width: '480', height: '800' } // targetProject: WP 8.1
];
- var splashScreensFiles = splashScreens.map(function(splash) {
+ var splashScreensFiles = splashScreens.map(function (splash) {
return path.basename(splash.src);
});
spyOn(fs, 'readdirSync').and.returnValue(splashScreensFiles);
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/a8692238/spec/unit/Version.spec.js
----------------------------------------------------------------------
diff --git a/spec/unit/Version.spec.js b/spec/unit/Version.spec.js
index 7f5882a..e33702f 100644
--- a/spec/unit/Version.spec.js
+++ b/spec/unit/Version.spec.js
@@ -45,9 +45,9 @@ describe('Version constructor', function () {
});
});
-describe('Version parse functions work as expected.', function() {
+describe('Version parse functions work as expected.', function () {
- it('Test #001 : should behave correctly', function() {
+ it('Test #001 : should behave correctly', function () {
var version = Version.fromString('1.2.4.7');
expect(version.major).toBe(1);
expect(version.minor).toBe(2);
@@ -55,7 +55,7 @@ describe('Version parse functions work as expected.', function() {
expect(version.qfe).toBe(7);
});
- it('Test #002 : should parse incomplete version string.', function() {
+ it('Test #002 : should parse incomplete version string.', function () {
var version = Version.fromString('1.5.3');
expect(version.major).toBe(1);
expect(version.minor).toBe(5);
@@ -63,32 +63,30 @@ describe('Version parse functions work as expected.', function() {
expect(version.qfe).toBe(0);
});
- it('Test #003 : should produce an error as the version string is invalid', function() {
+ it('Test #003 : should produce an error as the version string is invalid', function () {
try {
Version.fromString('This is invalid.');
expect(false).toBe(true);
- }
- catch (ex) {
+ } catch (ex) {
expect(ex.constructor).toBe(RangeError);
}
});
- it('Test #004 : should produce an error as the string is too long.', function() {
+ it('Test #004 : should produce an error as the string is too long.', function () {
try {
Version.fromString('1.5.3.2.7');
expect(false).toBe(true);
- }
- catch (ex) {
+ } catch (ex) {
expect(ex.constructor).toBe(RangeError);
}
expect(Version.tryParse('This is invalid')).toBe(false);
});
});
-describe('Version equality functions work as expected.', function() {
- it('Test #005 : should parse incomplete version string.', function() {
+describe('Version equality functions work as expected.', function () {
+ it('Test #005 : should parse incomplete version string.', function () {
var v1Base = new Version(1, 1, 2, 3);
// equal to v1Base
var v1Copy = new Version(1, 1, 2, 3);
@@ -123,8 +121,8 @@ describe('Version equality functions work as expected.', function() {
});
});
-describe('Version equality tests integrate with Array sort and toString() as expected.', function() {
- it('Test #006 : should parse incomplete version string.', function() {
+describe('Version equality tests integrate with Array sort and toString() as expected.', function () {
+ it('Test #006 : should parse incomplete version string.', function () {
var v1Base = new Version(1, 1, 2, 3);
// equal to v1Base
var v1Copy = new Version(1, 1, 2, 3);
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/a8692238/spec/unit/WindowsConfigParser.spec.js
----------------------------------------------------------------------
diff --git a/spec/unit/WindowsConfigParser.spec.js b/spec/unit/WindowsConfigParser.spec.js
index 4180dc6..5565b1e 100644
--- a/spec/unit/WindowsConfigParser.spec.js
+++ b/spec/unit/WindowsConfigParser.spec.js
@@ -45,7 +45,7 @@ describe('getAllMinMaxUAPVersions method', function () {
mockConfig = new ConfigParser('/some/file');
});
- it('should correctly transform all versions as a baseline.', function() {
+ it('should correctly transform all versions as a baseline.', function () {
spyOn(mockConfig, 'getMatchingPreferences').and.returnValue([
{ name: 'Windows.Universal-MinVersion', value: '10.0.9910.0' },
{ name: 'Windows.Universal-MaxVersionTested', value: '10.0.9917.0' },
@@ -72,7 +72,7 @@ describe('getAllMinMaxUAPVersions method', function () {
expect(versionSet[2].MaxVersionTested).toBe(ver9917);
});
- it('should produce versions correctly even when the config file has no settings.', function() {
+ it('should produce versions correctly even when the config file has no settings.', function () {
spyOn(mockConfig, 'getMatchingPreferences').and.returnValue([]);
var versionSet = mockConfig.getAllMinMaxUAPVersions();
@@ -86,18 +86,17 @@ describe('getAllMinMaxUAPVersions method', function () {
});
- it('should fail with a RangeError if version specified incorrectly', function() {
+ it('should fail with a RangeError if version specified incorrectly', function () {
spyOn(mockConfig, 'getMatchingPreferences')
- .and.returnValue([
- { name: 'Windows.Universal-MinVersion', value: '10.0.9910.f' },
- { name: 'Windows.Universal-MaxVersionTested', value: '10.0.9917.0' },
- ]);
+ .and.returnValue([
+ { name: 'Windows.Universal-MinVersion', value: '10.0.9910.f' },
+ { name: 'Windows.Universal-MaxVersionTested', value: '10.0.9917.0' }
+ ]);
try {
mockConfig.getAllMinMaxUAPVersions();
expect(false).toBe(true);
- }
- catch (ex) {
+ } catch (ex) {
expect(ex.constructor).toBe(RangeError);
}
});
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/a8692238/spec/unit/build.spec.js
----------------------------------------------------------------------
diff --git a/spec/unit/build.spec.js b/spec/unit/build.spec.js
index 1c2bc5f..3b1634c 100644
--- a/spec/unit/build.spec.js
+++ b/spec/unit/build.spec.js
@@ -16,23 +16,23 @@
specific language governing permissions and limitations
under the License.
*/
-var Q = require('q'),
- fs = require('fs'),
- path = require('path'),
- rewire = require('rewire'),
- platformRoot = '../../template',
- testPath = 'testpath',
- buildPath = path.join(platformRoot, 'cordova', 'build'),
- prepare = require(platformRoot + '/cordova/lib/prepare.js'),
- build = rewire(platformRoot + '/cordova/lib/build.js');
+var Q = require('q');
+var fs = require('fs');
+var path = require('path');
+var rewire = require('rewire');
+var platformRoot = '../../template';
+var testPath = 'testpath';
+var buildPath = path.join(platformRoot, 'cordova', 'build');
+var prepare = require(platformRoot + '/cordova/lib/prepare.js');
+var build = rewire(platformRoot + '/cordova/lib/build.js');
var utils = require(platformRoot + '/cordova/lib/utils');
-var package = require(platformRoot + '/cordova/lib/package');
+var pkg = require(platformRoot + '/cordova/lib/package');
var AppxManifest = require(platformRoot + '/cordova/lib/AppxManifest');
var MSBuildTools = require(platformRoot + '/cordova/lib/MSBuildTools');
-function createFindAvailableVersionMock(version, path, buildSpy) {
- build.__set__('MSBuildTools.findAvailableVersion', function() {
+function createFindAvailableVersionMock (version, path, buildSpy) {
+ build.__set__('MSBuildTools.findAvailableVersion', function () {
return Q.resolve({
version: version,
path: path,
@@ -46,34 +46,34 @@ function createFindAvailableVersionMock(version, path, buildSpy) {
});
}
-function createFindAllAvailableVersionsMock(versionSet) {
- build.__set__('MSBuildTools.findAllAvailableVersions', function() {
+function createFindAllAvailableVersionsMock (versionSet) {
+ build.__set__('MSBuildTools.findAllAvailableVersions', function () {
return Q.resolve(versionSet);
});
}
-function createConfigParserMock(winVersion, phoneVersion) {
- build.__set__('ConfigParser', function() {
+function createConfigParserMock (winVersion, phoneVersion) {
+ build.__set__('ConfigParser', function () {
return {
- getPreference: function(prefName) {
+ getPreference: function (prefName) {
switch (prefName) {
- case 'windows-target-version':
- return winVersion;
- case 'windows-phone-target-version':
- return phoneVersion;
+ case 'windows-target-version':
+ return winVersion;
+ case 'windows-phone-target-version':
+ return phoneVersion;
}
},
- getWindowsTargetVersion: function() {
+ getWindowsTargetVersion: function () {
return winVersion;
},
- getWindowsPhoneTargetVersion: function() {
+ getWindowsPhoneTargetVersion: function () {
return phoneVersion;
}
};
});
}
-describe('run method', function() {
+describe('run method', function () {
var findAvailableVersionOriginal,
findAllAvailableVersionsOriginal,
configParserOriginal;
@@ -92,40 +92,40 @@ describe('run method', function() {
spyOn(utils, 'isCordovaProject').and.returnValue(true);
spyOn(prepare, 'applyPlatformConfig');
spyOn(prepare, 'updateBuildConfig');
- spyOn(package, 'getPackage').and.returnValue(Q({}));
+ spyOn(pkg, 'getPackage').and.returnValue(Q({}));
spyOn(AppxManifest, 'get').and.returnValue({
getIdentity: function () {
- return { setPublisher: function () {} };
+ return { setPublisher: function () {} };
},
write: function () {}
});
});
- afterEach(function() {
+ afterEach(function () {
build.__set__('MSBuildTools.findAvailableVersion', findAvailableVersionOriginal);
build.__set__('MSBuildTools.findAllAvailableVersions', findAllAvailableVersionsOriginal);
build.__set__('ConfigParser', configParserOriginal);
});
- it('spec.1 should reject if not launched from project directory', function(done) {
- var rejectSpy = jasmine.createSpy(),
- buildSpy = jasmine.createSpy();
+ it('spec.1 should reject if not launched from project directory', function (done) {
+ var rejectSpy = jasmine.createSpy();
+ var buildSpy = jasmine.createSpy();
// utils.isCordovaProject is a spy, so we can call andReturn directly on it
utils.isCordovaProject.and.returnValue(false);
- createFindAllAvailableVersionsMock([{version: '14.0', buildProject: buildSpy, path: testPath }]);
+ createFindAllAvailableVersionsMock([{ version: '14.0', buildProject: buildSpy, path: testPath }]);
build.run([ 'node', buildPath, '--release', '--debug' ])
- .fail(rejectSpy)
- .finally(function() {
- expect(rejectSpy).toHaveBeenCalled();
- expect(buildSpy).not.toHaveBeenCalled();
- done();
- });
+ .fail(rejectSpy)
+ .finally(function () {
+ expect(rejectSpy).toHaveBeenCalled();
+ expect(buildSpy).not.toHaveBeenCalled();
+ done();
+ });
});
- it('spec.2 should throw if both debug and release args specified', function() {
+ it('spec.2 should throw if both debug and release args specified', function () {
var buildSpy = jasmine.createSpy();
createFindAvailableVersionMock('14.0', testPath, buildSpy);
@@ -135,7 +135,7 @@ describe('run method', function() {
}).toThrow();
});
- it('spec.3 should throw if both phone and win args specified', function() {
+ it('spec.3 should throw if both phone and win args specified', function () {
var buildSpy = jasmine.createSpy();
createFindAvailableVersionMock('14.0', testPath, buildSpy);
@@ -147,211 +147,211 @@ describe('run method', function() {
it('should respect build configuration from \'buildConfig\' option', function (done) {
- createFindAllAvailableVersionsMock([{version: '14.0', buildProject: jasmine.createSpy(), path: testPath }]);
+ createFindAllAvailableVersionsMock([{ version: '14.0', buildProject: jasmine.createSpy(), path: testPath }]);
var buildConfigPath = path.resolve(__dirname, 'fixtures/fakeBuildConfig.json');
build.run({ buildConfig: buildConfigPath })
- .finally(function() {
- expect(prepare.updateBuildConfig).toHaveBeenCalled();
- var buildOpts = prepare.updateBuildConfig.calls.argsFor(0)[0];
- var buildConfig = require(buildConfigPath).windows.debug;
- expect(buildOpts.packageCertificateKeyFile).toBeDefined();
- expect(buildOpts.packageCertificateKeyFile)
- .toEqual(path.resolve(path.dirname(buildConfigPath), buildConfig.packageCertificateKeyFile));
-
- ['packageThumbprint', 'publisherId'].forEach(function (key) {
- expect(buildOpts[key]).toBeDefined();
- expect(buildOpts[key]).toEqual(buildConfig[key]);
+ .finally(function () {
+ expect(prepare.updateBuildConfig).toHaveBeenCalled();
+ var buildOpts = prepare.updateBuildConfig.calls.argsFor(0)[0];
+ var buildConfig = require(buildConfigPath).windows.debug;
+ expect(buildOpts.packageCertificateKeyFile).toBeDefined();
+ expect(buildOpts.packageCertificateKeyFile)
+ .toEqual(path.resolve(path.dirname(buildConfigPath), buildConfig.packageCertificateKeyFile));
+
+ ['packageThumbprint', 'publisherId'].forEach(function (key) {
+ expect(buildOpts[key]).toBeDefined();
+ expect(buildOpts[key]).toEqual(buildConfig[key]);
+ });
+ done();
+ }).fail(function err (errMsg) {
+ expect(errMsg).toBeUndefined();
+ done();
});
- done();
- }).fail(function err (errMsg) {
- expect(errMsg).toBeUndefined();
- done();
- });
}, 20000);
- it('spec.4 should call buildProject of MSBuildTools with buildType = "release" if called with --release argument', function(done) {
+ it('spec.4 should call buildProject of MSBuildTools with buildType = "release" if called with --release argument', function (done) {
var buildSpy = jasmine.createSpy().and.callFake(function (solutionFile, buildType, buildArch) {
expect(buildType).toBe('release');
});
- createFindAllAvailableVersionsMock([{version: '14.0', buildProject: buildSpy, path: testPath }]);
+ createFindAllAvailableVersionsMock([{ version: '14.0', buildProject: buildSpy, path: testPath }]);
build.run({ release: true })
- .finally(function() {
- expect(buildSpy).toHaveBeenCalled();
- done();
- });
+ .finally(function () {
+ expect(buildSpy).toHaveBeenCalled();
+ done();
+ });
});
- it('spec.5 should call buildProject of MSBuildTools with buildType = "debug" if called without arguments', function(done) {
+ it('spec.5 should call buildProject of MSBuildTools with buildType = "debug" if called without arguments', function (done) {
var buildSpy = jasmine.createSpy().and.callFake(function (solutionFile, buildType, buildArch) {
expect(buildType).toBe('debug');
});
- createFindAllAvailableVersionsMock([{version: '14.0', buildProject: buildSpy, path: testPath }]);
+ createFindAllAvailableVersionsMock([{ version: '14.0', buildProject: buildSpy, path: testPath }]);
build.run([ 'node', buildPath ])
- .finally(function() {
- expect(buildSpy).toHaveBeenCalled();
- done();
- });
+ .finally(function () {
+ expect(buildSpy).toHaveBeenCalled();
+ done();
+ });
});
- it('spec.6 should call buildProject of MSBuildTools with buildArch = "arm" if called with --archs="arm" argument', function(done) {
+ it('spec.6 should call buildProject of MSBuildTools with buildArch = "arm" if called with --archs="arm" argument', function (done) {
var buildSpy = jasmine.createSpy().and.callFake(function (solutionFile, buildType, buildArch) {
expect(buildArch).toBe('arm');
});
- createFindAllAvailableVersionsMock([{version: '14.0', buildProject: buildSpy, path: testPath }]);
+ createFindAllAvailableVersionsMock([{ version: '14.0', buildProject: buildSpy, path: testPath }]);
build.run({ archs: 'arm' })
- .finally(function() {
- expect(buildSpy).toHaveBeenCalled();
- done();
- });
+ .finally(function () {
+ expect(buildSpy).toHaveBeenCalled();
+ done();
+ });
});
- it('spec.7 should call buildProject of MSBuildTools once for all architectures if called with --archs="arm x86 x64 anycpu" argument', function(done) {
- var armBuild = jasmine.createSpy(),
- x86Build = jasmine.createSpy(),
- x64Build = jasmine.createSpy(),
- anyCpuBuild = jasmine.createSpy();
+ it('spec.7 should call buildProject of MSBuildTools once for all architectures if called with --archs="arm x86 x64 anycpu" argument', function (done) {
+ var armBuild = jasmine.createSpy();
+ var x86Build = jasmine.createSpy();
+ var x64Build = jasmine.createSpy();
+ var anyCpuBuild = jasmine.createSpy();
createFindAllAvailableVersionsMock([
{
version: '14.0',
path: testPath,
- buildProject: function(solutionFile, buildType, buildArch) {
+ buildProject: function (solutionFile, buildType, buildArch) {
expect(buildArch).toMatch(/^arm$|^any\s?cpu$|^x86$|^x64$/);
switch (buildArch) {
- case 'arm':
- armBuild();
- return Q();
- case 'x86':
- x86Build();
- return Q();
- case 'anycpu':
- case 'any cpu':
- anyCpuBuild();
- return Q();
- case 'x64':
- x64Build();
- return Q();
- default:
- return Q.reject();
+ case 'arm':
+ armBuild();
+ return Q();
+ case 'x86':
+ x86Build();
+ return Q();
+ case 'anycpu':
+ case 'any cpu':
+ anyCpuBuild();
+ return Q();
+ case 'x64':
+ x64Build();
+ return Q();
+ default:
+ return Q.reject();
}
}
- }]);
+ }]);
build.run({ archs: 'arm x86 x64 anycpu', argv: ['--phone'] })
- .finally(function() {
- expect(armBuild).toHaveBeenCalled();
- expect(x86Build).toHaveBeenCalled();
- expect(x64Build).toHaveBeenCalled();
- expect(anyCpuBuild).toHaveBeenCalled();
- done();
- });
+ .finally(function () {
+ expect(armBuild).toHaveBeenCalled();
+ expect(x86Build).toHaveBeenCalled();
+ expect(x64Build).toHaveBeenCalled();
+ expect(anyCpuBuild).toHaveBeenCalled();
+ done();
+ });
});
- it('spec.8 should fail buildProject if built with MSBuildTools version 4.0', function(done) {
- var buildSpy = jasmine.createSpy(),
- errorSpy = jasmine.createSpy();
+ it('spec.8 should fail buildProject if built with MSBuildTools version 4.0', function (done) {
+ var buildSpy = jasmine.createSpy();
+ var errorSpy = jasmine.createSpy();
- createFindAllAvailableVersionsMock([{version: '4.0', buildProject: buildSpy, path: testPath }]);
+ createFindAllAvailableVersionsMock([{ version: '4.0', buildProject: buildSpy, path: testPath }]);
createConfigParserMock('8.0');
build.run({argv: ['--win']})
- .fail(function(error) {
- errorSpy();
- expect(error).toBeDefined();
- })
- .finally(function() {
- expect(errorSpy).toHaveBeenCalled();
- expect(buildSpy).not.toHaveBeenCalled();
- done();
- });
+ .fail(function (error) {
+ errorSpy();
+ expect(error).toBeDefined();
+ })
+ .finally(function () {
+ expect(errorSpy).toHaveBeenCalled();
+ expect(buildSpy).not.toHaveBeenCalled();
+ done();
+ });
});
- it('spec.9 should call buildProject of MSBuildTools if built for windows 8.1', function(done) {
+ it('spec.9 should call buildProject of MSBuildTools if built for windows 8.1', function (done) {
var buildSpy = jasmine.createSpy();
- createFindAllAvailableVersionsMock([{version: '14.0', buildProject: buildSpy, path: testPath }]);
+ createFindAllAvailableVersionsMock([{ version: '14.0', buildProject: buildSpy, path: testPath }]);
createConfigParserMock('8.1');
build.run({argv: ['--win']})
- .finally(function() {
- expect(buildSpy).toHaveBeenCalled();
- done();
- });
+ .finally(function () {
+ expect(buildSpy).toHaveBeenCalled();
+ done();
+ });
});
- it('spec.10 should throw an error if windows-target-version has unsupported value', function(done) {
- var buildSpy = jasmine.createSpy(),
- errorSpy = jasmine.createSpy();
+ it('spec.10 should throw an error if windows-target-version has unsupported value', function (done) {
+ var buildSpy = jasmine.createSpy();
+ var errorSpy = jasmine.createSpy();
createFindAvailableVersionMock('14.0', testPath, buildSpy);
createConfigParserMock('unsupported value here');
build.run({argv: ['--win']})
- .fail(function(error) {
- errorSpy();
- expect(error).toBeDefined();
- })
- .finally(function() {
- expect(errorSpy).toHaveBeenCalled();
- expect(buildSpy).not.toHaveBeenCalled();
- done();
- });
+ .fail(function (error) {
+ errorSpy();
+ expect(error).toBeDefined();
+ })
+ .finally(function () {
+ expect(errorSpy).toHaveBeenCalled();
+ expect(buildSpy).not.toHaveBeenCalled();
+ done();
+ });
});
- it('spec.11 should call buildProject of MSBuildTools if built for windows phone 8.1', function(done) {
+ it('spec.11 should call buildProject of MSBuildTools if built for windows phone 8.1', function (done) {
var buildSpy = jasmine.createSpy();
- createFindAllAvailableVersionsMock([{version: '14.0', buildProject: buildSpy, path: testPath }]);
+ createFindAllAvailableVersionsMock([{ version: '14.0', buildProject: buildSpy, path: testPath }]);
createConfigParserMock(null, '8.1');
build.run({argv: ['--phone']})
- .finally(function() {
- expect(buildSpy).toHaveBeenCalled();
- done();
- });
+ .finally(function () {
+ expect(buildSpy).toHaveBeenCalled();
+ done();
+ });
});
- it('spec.12 should throw an error if windows-phone-target-version has unsupported value', function(done) {
- var buildSpy = jasmine.createSpy(),
- errorSpy = jasmine.createSpy();
+ it('spec.12 should throw an error if windows-phone-target-version has unsupported value', function (done) {
+ var buildSpy = jasmine.createSpy();
+ var errorSpy = jasmine.createSpy();
createFindAvailableVersionMock('14.0', testPath, buildSpy);
createConfigParserMock(null, 'unsupported value here');
build.run({argv: ['--phone']})
- .fail(function(error) {
- errorSpy();
- expect(error).toBeDefined();
- })
- .finally(function() {
- expect(errorSpy).toHaveBeenCalled();
- expect(buildSpy).not.toHaveBeenCalled();
- done();
- });
+ .fail(function (error) {
+ errorSpy();
+ expect(error).toBeDefined();
+ })
+ .finally(function () {
+ expect(errorSpy).toHaveBeenCalled();
+ expect(buildSpy).not.toHaveBeenCalled();
+ done();
+ });
});
- it('spec.13 should be able to override target via --appx parameter', function(done) {
- var buildSpy = jasmine.createSpy().and.callFake(function(solutionFile, buildType, buildArch) {
- // check that we build Windows 10 and not Windows 8.1
- expect(solutionFile.toLowerCase()).toMatch('cordovaapp.windows10.jsproj');
- });
+ it('spec.13 should be able to override target via --appx parameter', function (done) {
+ var buildSpy = jasmine.createSpy().and.callFake(function (solutionFile, buildType, buildArch) {
+ // check that we build Windows 10 and not Windows 8.1
+ expect(solutionFile.toLowerCase()).toMatch('cordovaapp.windows10.jsproj');
+ });
- createFindAllAvailableVersionsMock([{version: '14.0', buildProject: buildSpy, path: testPath }]);
+ createFindAllAvailableVersionsMock([{ version: '14.0', buildProject: buildSpy, path: testPath }]);
// provision config to target Windows 8.1
createConfigParserMock('8.1', '8.1');
// explicitly specify Windows 10 as target
build.run({argv: ['--appx=uap']})
- .finally(function() {
- expect(buildSpy).toHaveBeenCalled();
- done();
- });
+ .finally(function () {
+ expect(buildSpy).toHaveBeenCalled();
+ done();
+ });
});
it('spec.14 should use user-specified msbuild if VSINSTALLDIR variable is set', function (done) {
@@ -370,30 +370,30 @@ describe('run method', function() {
var fail = jasmine.createSpy('fail');
build.run({})
- .fail(fail)
- .finally(function() {
- expect(fail).not.toHaveBeenCalled();
- expect(MSBuildTools.getMSBuildToolsAt).toHaveBeenCalledWith(msBuildBinPath);
- delete process.env.VSINSTALLDIR;
- done();
- });
+ .fail(fail)
+ .finally(function () {
+ expect(fail).not.toHaveBeenCalled();
+ expect(MSBuildTools.getMSBuildToolsAt).toHaveBeenCalledWith(msBuildBinPath);
+ delete process.env.VSINSTALLDIR;
+ done();
+ });
});
- it('spec.15 should choose latest version if there are multiple versions available with minor version difference', function(done) {
+ it('spec.15 should choose latest version if there are multiple versions available with minor version difference', function (done) {
var fail = jasmine.createSpy('fail');
- var buildTools14 = {version: '14.0', buildProject: jasmine.createSpy('buildTools14'), path: testPath };
- var buildTools15 = {version: '15.0', buildProject: jasmine.createSpy('buildTools15'), path: testPath };
- var buildTools151 = {version: '15.1', buildProject: jasmine.createSpy('buildTools151'), path: testPath };
+ var buildTools14 = { version: '14.0', buildProject: jasmine.createSpy('buildTools14'), path: testPath };
+ var buildTools15 = { version: '15.0', buildProject: jasmine.createSpy('buildTools15'), path: testPath };
+ var buildTools151 = { version: '15.1', buildProject: jasmine.createSpy('buildTools151'), path: testPath };
createFindAllAvailableVersionsMock([buildTools14, buildTools15, buildTools151]);
// explicitly specify Windows 10 as target
build.run({argv: ['--appx=uap']})
- .fail(fail)
- .finally(function() {
- expect(fail).not.toHaveBeenCalled();
- expect(buildTools151.buildProject).toHaveBeenCalled();
- done();
- });
+ .fail(fail)
+ .finally(function () {
+ expect(fail).not.toHaveBeenCalled();
+ expect(buildTools151.buildProject).toHaveBeenCalled();
+ done();
+ });
});
});
@@ -426,19 +426,19 @@ describe('buildFlags', function () {
spyOn(utils, 'isCordovaProject').and.returnValue(true);
spyOn(prepare, 'applyPlatformConfig');
spyOn(prepare, 'updateBuildConfig');
- spyOn(package, 'getPackage').and.returnValue(Q({}));
+ spyOn(pkg, 'getPackage').and.returnValue(Q({}));
spyOn(AppxManifest, 'get').and.returnValue({
getIdentity: function () {
- return { setPublisher: function () {} };
+ return { setPublisher: function () {} };
},
write: function () {}
});
});
- it('should pass buildFlags directly to MSBuild', function(done) {
+ it('should pass buildFlags directly to MSBuild', function (done) {
var fail = jasmine.createSpy('fail');
- var buildTools = {version: '14.0', buildProject: jasmine.createSpy('buildProject').and.returnValue(Q()), path: testPath };
+ var buildTools = { version: '14.0', buildProject: jasmine.createSpy('buildProject').and.returnValue(Q()), path: testPath };
var buildOptions = {
argv: ['--buildFlag', 'foo=bar']
};
@@ -446,15 +446,15 @@ describe('buildFlags', function () {
createFindAllAvailableVersionsMock([buildTools]);
build.run(buildOptions)
- .fail(fail)
- .finally(function() {
- expect(fail).not.toHaveBeenCalled();
- // CB-12416 AppxBundle=Never is present because we are not building a bundle
- expect(buildTools.buildProject).toHaveBeenCalledWith(jasmine.any(String),
- jasmine.any(String), jasmine.any(String), [ 'foo=bar', '/p:AppxBundle=Never' ]);
-
- done();
- });
+ .fail(fail)
+ .finally(function () {
+ expect(fail).not.toHaveBeenCalled();
+ // CB-12416 AppxBundle=Never is present because we are not building a bundle
+ expect(buildTools.buildProject).toHaveBeenCalledWith(jasmine.any(String),
+ jasmine.any(String), jasmine.any(String), [ 'foo=bar', '/p:AppxBundle=Never' ]);
+
+ done();
+ });
});
});
});
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/a8692238/spec/unit/check_reqs.spec.js
----------------------------------------------------------------------
diff --git a/spec/unit/check_reqs.spec.js b/spec/unit/check_reqs.spec.js
index 62c8e61..433177c 100644
--- a/spec/unit/check_reqs.spec.js
+++ b/spec/unit/check_reqs.spec.js
@@ -52,7 +52,7 @@ describe('check_reqs module', function () {
});
});
- describe('has check_all method', function() {
+ describe('has check_all method', function () {
// var consoleLogOriginal;
var Requirement,
@@ -83,7 +83,7 @@ describe('check_reqs module', function () {
fakeConfig = new ConfigParser('/some/file');
});
- afterEach(function() {
+ afterEach(function () {
check_reqs.__set__('requirements', originalrequirements);
check_reqs.__set__('checkFns', originalcheckFns);
check_reqs.__set__('config', originalconfig);
@@ -106,42 +106,42 @@ describe('check_reqs module', function () {
});
});
- it('Test #003 : that should not reject if one of requirements is not installed', function (done) {
+ it('Test #003 : that should not reject if one of requirements is not installed', function (done) {
check_reqs.__set__('requirements', fakeRequirements);
fakeCheckFns[0] = function () { return Q.reject('Error message'); };
check_reqs.__set__('checkFns', fakeCheckFns);
check_reqs.__set__('config', fakeConfig);
check_reqs.check_all()
- .then(function (requirements) {
- expect(requirements.length).toBe(3);
- expect(requirements[0].installed).toBeFalsy();
- done();
- })
- .catch(function (error) {
- expect(error).not.toBeDefined();
- done();
- });
+ .then(function (requirements) {
+ expect(requirements.length).toBe(3);
+ expect(requirements[0].installed).toBeFalsy();
+ done();
+ })
+ .catch(function (error) {
+ expect(error).not.toBeDefined();
+ done();
+ });
});
- it('Test #004 : that should reject if one of checks has internal erorrs', function (done) {
+ it('Test #004 : that should reject if one of checks has internal erorrs', function (done) {
check_reqs.__set__('requirements', fakeRequirements);
fakeCheckFns[0] = checkSpy.and.throwError('Fatal error');
check_reqs.__set__('checkFns', fakeCheckFns);
check_reqs.__set__('config', fakeConfig);
check_reqs.check_all()
- .then(function (requirements) {
- expect(requirements).not.toBeDefined();
- done();
- })
- .catch(function (error) {
- expect(error).toMatch('Fatal error');
- done();
- });
+ .then(function (requirements) {
+ expect(requirements).not.toBeDefined();
+ done();
+ })
+ .catch(function (error) {
+ expect(error).toMatch('Fatal error');
+ done();
+ });
});
- it('Test #005 : that should not run other requirements checks if `fatal` requirement isn\'t installed', function (done) {
+ it('Test #005 : that should not run other requirements checks if `fatal` requirement isn\'t installed', function (done) {
check_reqs.__set__('requirements', fakeRequirements);
// The second requirement is fatal, so we're setting up second check to fail
fakeCheckFns[1] = checkSpy.and.returnValue(Q.reject('Error message'));
@@ -149,16 +149,16 @@ describe('check_reqs module', function () {
check_reqs.__set__('config', fakeConfig);
check_reqs.check_all()
- .then(function (requirements) {
- expect(requirements.length).toBe(2);
- expect(requirements[1].isFatal).toBeTruthy();
- expect(checkSpy.calls.count()).toBe(2);
- done();
- })
- .catch(function (error) {
- expect(error).not.toBeDefined();
- done();
- });
+ .then(function (requirements) {
+ expect(requirements.length).toBe(2);
+ expect(requirements[1].isFatal).toBeTruthy();
+ expect(checkSpy.calls.count()).toBe(2);
+ done();
+ })
+ .catch(function (error) {
+ expect(error).not.toBeDefined();
+ done();
+ });
});
});
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/a8692238/spec/unit/clean.spec.js
----------------------------------------------------------------------
diff --git a/spec/unit/clean.spec.js b/spec/unit/clean.spec.js
index 5d9148a..c68b012 100644
--- a/spec/unit/clean.spec.js
+++ b/spec/unit/clean.spec.js
@@ -1,12 +1,13 @@
-var shell = require('shelljs'),
- path = require('path'),
- fs = require('fs'),
- prepareModule = require('../../template/cordova/lib/prepare'),
- DUMMY_PROJECT_PATH = path.join(__dirname, '/fixtures/DummyProject'),
- iconPath, currentProject;
+var shell = require('shelljs');
+var path = require('path');
+var fs = require('fs');
+var prepareModule = require('../../template/cordova/lib/prepare');
+var DUMMY_PROJECT_PATH = path.join(__dirname, '/fixtures/DummyProject');
+var iconPath;
+var currentProject;
-describe('Cordova clean command', function() {
- beforeEach(function() {
+describe('Cordova clean command', function () {
+ beforeEach(function () {
shell.cp('-rf', DUMMY_PROJECT_PATH, __dirname);
currentProject = path.join(__dirname, 'DummyProject');
iconPath = path.join(currentProject, 'images/SplashScreen.scale-100.png');
@@ -21,17 +22,17 @@ describe('Cordova clean command', function() {
if (/SplashScreen\.scale-100\.png$/.test(filePath)) {
// Use absolute path:
return fsStatSyncOrig(iconPath);
- }
+ }
return fsStatSyncOrig(filePath);
});
});
- afterEach(function() {
+ afterEach(function () {
shell.rm('-rf', currentProject);
});
- it('spec 1. should remove icons when ran inside Cordova project', function(done) {
+ it('spec 1. should remove icons when ran inside Cordova project', function (done) {
var config = {
platform: 'windows',
root: currentProject,
@@ -42,17 +43,17 @@ describe('Cordova clean command', function() {
}
};
- var rejected = jasmine.createSpy().and.callFake(function(err) {
+ var rejected = jasmine.createSpy().and.callFake(function (err) {
// Log error:
expect(err).not.toBeDefined();
});
prepareModule.clean.call(config)
- .then(function() {
- expect(fs.existsSync(iconPath)).toBeFalsy();
- }, rejected)
- .finally(function() {
- expect(rejected).not.toHaveBeenCalled();
- done();
- });
+ .then(function () {
+ expect(fs.existsSync(iconPath)).toBeFalsy();
+ }, rejected)
+ .finally(function () {
+ expect(rejected).not.toHaveBeenCalled();
+ done();
+ });
});
});
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/a8692238/spec/unit/deployment.spec.js
----------------------------------------------------------------------
diff --git a/spec/unit/deployment.spec.js b/spec/unit/deployment.spec.js
index 8f3e3cd..fb62d48 100644
--- a/spec/unit/deployment.spec.js
+++ b/spec/unit/deployment.spec.js
@@ -17,25 +17,25 @@
under the License.
*/
-var rewire = require('rewire'),
- deployment = rewire('../../template/cordova/lib/deployment'),
- Q = require('q'),
- path = require('path'),
- AppDeployCmdTool = deployment.__get__('AppDeployCmdTool'),
- WinAppDeployCmdTool = deployment.__get__('WinAppDeployCmdTool');
+var rewire = require('rewire');
+var deployment = rewire('../../template/cordova/lib/deployment');
+var Q = require('q');
+var path = require('path');
+var AppDeployCmdTool = deployment.__get__('AppDeployCmdTool');
+var WinAppDeployCmdTool = deployment.__get__('WinAppDeployCmdTool');
-var TEST_APP_PACKAGE_NAME = '"c:\\testapppackage.appx"',
- TEST_APP_PACKAGE_ID = '12121212-3434-3434-3434-567856785678';
+var TEST_APP_PACKAGE_NAME = '"c:\\testapppackage.appx"';
+var TEST_APP_PACKAGE_ID = '12121212-3434-3434-3434-567856785678';
-describe('The correct version of the app deployment tool is obtained.', function() {
+describe('The correct version of the app deployment tool is obtained.', function () {
var mockedProgramFiles = process.env['ProgramFiles(x86)'];
- beforeEach(function() {
+ beforeEach(function () {
process.env['ProgramFiles(x86)'] = path.join('c:/Program Files (x86)');
});
- afterEach(function() {
+ afterEach(function () {
if (mockedProgramFiles) {
process.env['ProgramFiles(x86)'] = mockedProgramFiles;
} else {
@@ -43,14 +43,14 @@ describe('The correct version of the app deployment tool is obtained.', function
}
});
- it('Test #000 : Provides an AppDeployCmdTool when 8.1 is requested.', function() {
+ it('Test #000 : Provides an AppDeployCmdTool when 8.1 is requested.', function () {
var tool = deployment.getDeploymentTool('8.1');
expect(tool instanceof AppDeployCmdTool).toBe(true);
});
- it('Test #001 : Provides a WinAppDeployCmdTool when 10.0 is requested.', function() {
+ it('Test #001 : Provides a WinAppDeployCmdTool when 10.0 is requested.', function () {
var tool = deployment.getDeploymentTool('10.0');
expect(tool instanceof WinAppDeployCmdTool).toBe(true);
@@ -58,25 +58,25 @@ describe('The correct version of the app deployment tool is obtained.', function
});
});
-describe('Windows 10 deployment interacts with the file system as expected.', function() {
+describe('Windows 10 deployment interacts with the file system as expected.', function () {
- function fakeSpawn(cmd, args, cwd) {
+ function fakeSpawn (cmd, args, cwd) {
expect(cmd).toBe(path.join('c:/Program Files (x86)/Windows Kits/10/bin/x86/WinAppDeployCmd.exe'));
switch (args[0]) {
- case 'devices':
- var output = 'Windows App Deployment Tool\r\nVersion 10.0.0.0\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\n\r\nDiscovering devices...\r\nIP Address GUID Model/Name\r\n127.0.0.1 00000015-b21e-0da9-0000-000000000000 Lumia 1520 (RM-940)\r\n10.120.70.172 00000000-0000-0000-0000-00155d619532 00155D619532\r\n10.120.68.150 00000000-0000-0000-0000-00155d011765 00155D011765\r\nDone.';
- return Q(output);
+ case 'devices':
+ var output = 'Windows App Deployment Tool\r\nVersion 10.0.0.0\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\n\r\nDiscovering devices...\r\nIP Address GUID Model/Name\r\n127.0.0.1 00000015-b21e-0da9-0000-000000000000 Lumia 1520 (RM-940)\r\n10.120.70.172 00000000-0000-0000-0000-00155d619532 00155D619532\r\n10.120.68.150 00000000-0000-0000-0000-00155d011765 00155D011765\r\nDone.';
+ return Q(output);
- case 'update':
- case 'install':
- expect(args[2]).toBe(TEST_APP_PACKAGE_NAME);
- expect(args[4]).toBe('127.0.0.1');
- return Q('');
+ case 'update':
+ case 'install':
+ expect(args[2]).toBe(TEST_APP_PACKAGE_NAME);
+ expect(args[4]).toBe('127.0.0.1');
+ return Q('');
- case 'uninstall':
- expect(args[2]).toBe(TEST_APP_PACKAGE_ID);
- expect(args[4]).toBe('10.120.68.150');
- return Q('');
+ case 'uninstall':
+ expect(args[2]).toBe(TEST_APP_PACKAGE_ID);
+ expect(args[4]).toBe('10.120.68.150');
+ return Q('');
}
}
@@ -84,12 +84,12 @@ describe('Windows 10 deployment interacts with the file system as expected.', fu
var mockedSpawn = deployment.__get__('spawn');
var mockedProgramFiles = process.env['ProgramFiles(x86)'];
- beforeEach(function() {
+ beforeEach(function () {
deployment.__set__('spawn', fakeSpawn);
process.env['ProgramFiles(x86)'] = path.join('c:/Program Files (x86)');
});
- afterEach(function() {
+ afterEach(function () {
deployment.__set__('spawn', mockedSpawn);
if (mockedProgramFiles) {
process.env['ProgramFiles(x86)'] = mockedProgramFiles;
@@ -98,82 +98,82 @@ describe('Windows 10 deployment interacts with the file system as expected.', fu
}
});
- it('Test #002 : enumerateDevices returns a valid set of objects', function(done) {
+ it('Test #002 : enumerateDevices returns a valid set of objects', function (done) {
var deploymentTool = deployment.getDeploymentTool('10.0');
deploymentTool.enumerateDevices()
- .then(function(deviceList) {
- expect(deviceList.length).toBe(3);
- expect(deviceList[0].name).toBe('Lumia 1520 (RM-940)');
- expect(deviceList[0].index).toBe(0);
- expect(deviceList[0].type).toBe('device');
- done();
- }).fail(function err (errMsg) {
- expect(errMsg).toBeUndefined();
- done();
- });
+ .then(function (deviceList) {
+ expect(deviceList.length).toBe(3);
+ expect(deviceList[0].name).toBe('Lumia 1520 (RM-940)');
+ expect(deviceList[0].index).toBe(0);
+ expect(deviceList[0].type).toBe('device');
+ done();
+ }).fail(function err (errMsg) {
+ expect(errMsg).toBeUndefined();
+ done();
+ });
});
- it('Test #003 : installAppPackage passes the correct set of parameters', function(done) {
+ it('Test #003 : installAppPackage passes the correct set of parameters', function (done) {
var deploymentTool = deployment.getDeploymentTool('10.0');
deploymentTool.enumerateDevices()
- .then(function(deviceList) {
- deploymentTool.installAppPackage(TEST_APP_PACKAGE_NAME, deviceList[0], /*shouldLaunch*/ false, /*shouldUpdate*/ false);
- done();
- }).fail(function err (errMsg) {
- expect(errMsg).toBeUndefined();
- done();
- });
+ .then(function (deviceList) {
+ deploymentTool.installAppPackage(TEST_APP_PACKAGE_NAME, deviceList[0], /* shouldLaunch */ false, /* shouldUpdate */ false);
+ done();
+ }).fail(function err (errMsg) {
+ expect(errMsg).toBeUndefined();
+ done();
+ });
});
- it('Test #004 : installAppPackage passes the correct set of parameters when updating', function(done) {
+ it('Test #004 : installAppPackage passes the correct set of parameters when updating', function (done) {
var deploymentTool = deployment.getDeploymentTool('10.0');
deploymentTool.enumerateDevices()
- .then(function(deviceList) {
- deploymentTool.installAppPackage(TEST_APP_PACKAGE_NAME, deviceList[0], /*shouldLaunch*/ false, /*shouldUpdate*/ true);
- done();
- }).fail(function err (errMsg) {
- expect(errMsg).toBeUndefined();
- done();
- });
+ .then(function (deviceList) {
+ deploymentTool.installAppPackage(TEST_APP_PACKAGE_NAME, deviceList[0], /* shouldLaunch */ false, /* shouldUpdate */ true);
+ done();
+ }).fail(function err (errMsg) {
+ expect(errMsg).toBeUndefined();
+ done();
+ });
});
- it('Test #005 : uninstallAppPackage passes the correct set of parameters', function(done) {
+ it('Test #005 : uninstallAppPackage passes the correct set of parameters', function (done) {
var deploymentTool = deployment.getDeploymentTool('10.0');
deploymentTool.enumerateDevices()
- .then(function(deviceList) {
- deploymentTool.uninstallAppPackage(TEST_APP_PACKAGE_ID, deviceList[2]);
- done();
- }).fail(function err (errMsg) {
- expect(errMsg).toBeUndefined();
- done();
- });
+ .then(function (deviceList) {
+ deploymentTool.uninstallAppPackage(TEST_APP_PACKAGE_ID, deviceList[2]);
+ done();
+ }).fail(function err (errMsg) {
+ expect(errMsg).toBeUndefined();
+ done();
+ });
});
});
-describe('Windows 8.1 deployment interacts with the file system as expected.', function() {
+describe('Windows 8.1 deployment interacts with the file system as expected.', function () {
- function fakeSpawn(cmd, args, cwd) {
+ function fakeSpawn (cmd, args, cwd) {
expect(cmd).toBe(path.join('c:/Program Files (x86)/Microsoft SDKs/Windows Phone/v8.1/Tools/AppDeploy/AppDeployCmd.exe'));
switch (args[0]) {
- case '/EnumerateDevices':
- var output = '\r\nDevice Index Device Name\r\n------------ -------------------------------\r\n 0 Device\r\n 1 Mobile Emulator 10.0.10150.0 WVGA 4 inch 512MB\r\n 2 Mobile Emulator 10.0.10150.0 WVGA 4 inch 1GB\r\n 3 Mobile Emulator 10.0.10150.0 WXGA 4.5 inch 1GB\r\n 4 Mobile Emulator 10.0.10150.0 720p 5 inch 1GB\r\n 5 Mobile Emulator 10.0.10150.0 1080p 6 inch 2GB\r\n 6 Emulator 8.1 WVGA 4 inch 512MB\r\n 7 Emulator 8.1 WVGA 4 inch\r\n 8 Emulator 8.1 WXGA 4.5 inch\r\n 9 Emulator 8.1 720P 4.7 inch\r\n 10 Emulator 8.1 1080P 5.5 inch\r\n 11 Emulator 8.1 1080P 6 inch\r\nDone.\r\n';
- return Q(output);
-
- case '/update':
- case '/install':
- case '/updatelaunch':
- case '/installlaunch':
- expect(args[1]).toBe(TEST_APP_PACKAGE_NAME);
- expect(args[2]).toBe('/targetdevice:de');
- return Q('');
-
- case '/uninstall':
- expect(args[1]).toBe(TEST_APP_PACKAGE_ID);
- expect(args[2]).toBe('/targetdevice:5');
- return Q('');
-
- default:
- throw new Error('Unrecognized AppDeployCmd parameter "' + args[0] + '"');
+ case '/EnumerateDevices':
+ var output = '\r\nDevice Index Device Name\r\n------------ -------------------------------\r\n 0 Device\r\n 1 Mobile Emulator 10.0.10150.0 WVGA 4 inch 512MB\r\n 2 Mobile Emulator 10.0.10150.0 WVGA 4 inch 1GB\r\n 3 Mobile Emulator 10.0.10150.0 WXGA 4.5 inch 1GB\r\n 4 Mobile Emulator 10.0.10150.0 720p 5 inch 1GB\r\n 5 Mobile Emulator 10.0.10150.0 1080p 6 inch 2GB\r\n 6 Emulator 8.1 WVGA 4 inch 512MB\r\n 7 Emulator 8.1 WVGA 4 inch\r\n 8 Emulator 8.1 WXGA 4.5 inch\r\n 9 Emulator 8.1 720P 4.7 inch\r\n 10 Emulator 8.1 1080P 5.5 inch\r\n 11 Emulator 8.1 1080P 6 inch\r\nDone.\r\n';
+ return Q(output);
+
+ case '/update':
+ case '/install':
+ case '/updatelaunch':
+ case '/installlaunch':
+ expect(args[1]).toBe(TEST_APP_PACKAGE_NAME);
+ expect(args[2]).toBe('/targetdevice:de');
+ return Q('');
+
+ case '/uninstall':
+ expect(args[1]).toBe(TEST_APP_PACKAGE_ID);
+ expect(args[2]).toBe('/targetdevice:5');
+ return Q('');
+
+ default:
+ throw new Error('Unrecognized AppDeployCmd parameter "' + args[0] + '"');
}
}
@@ -181,12 +181,12 @@ describe('Windows 8.1 deployment interacts with the file system as expected.', f
var mockedSpawn = deployment.__get__('spawn');
var mockedProgramFiles = process.env['ProgramFiles(x86)'];
- beforeEach(function() {
+ beforeEach(function () {
deployment.__set__('spawn', fakeSpawn);
process.env['ProgramFiles(x86)'] = path.join('c:/Program Files (x86)');
});
- afterEach(function() {
+ afterEach(function () {
deployment.__set__('spawn', mockedSpawn);
if (mockedProgramFiles) {
process.env['ProgramFiles(x86)'] = mockedProgramFiles;
@@ -195,81 +195,81 @@ describe('Windows 8.1 deployment interacts with the file system as expected.', f
}
});
- it('Test #006 : enumerateDevices returns a valid set of objects', function(done) {
+ it('Test #006 : enumerateDevices returns a valid set of objects', function (done) {
var deploymentTool = deployment.getDeploymentTool('8.1');
deploymentTool.enumerateDevices()
- .then(function(deviceList) {
- expect(deviceList.length).toBe(12);
- expect(deviceList[0].name).toBe('Device');
- expect(deviceList[0].index).toBe(0);
- expect(deviceList[0].type).toBe('device');
- expect(deviceList[5].name).toBe('Mobile Emulator 10.0.10150.0 1080p 6 inch 2GB');
- expect(deviceList[5].index).toBe(5);
- expect(deviceList[5].type).toBe('emulator');
- done();
- }).fail(function err (errMsg) {
- expect(errMsg).toBeUndefined();
- done();
- });
+ .then(function (deviceList) {
+ expect(deviceList.length).toBe(12);
+ expect(deviceList[0].name).toBe('Device');
+ expect(deviceList[0].index).toBe(0);
+ expect(deviceList[0].type).toBe('device');
+ expect(deviceList[5].name).toBe('Mobile Emulator 10.0.10150.0 1080p 6 inch 2GB');
+ expect(deviceList[5].index).toBe(5);
+ expect(deviceList[5].type).toBe('emulator');
+ done();
+ }).fail(function err (errMsg) {
+ expect(errMsg).toBeUndefined();
+ done();
+ });
});
- it('Test #007 : installAppPackage passes the correct set of parameters', function(done) {
+ it('Test #007 : installAppPackage passes the correct set of parameters', function (done) {
var deploymentTool = deployment.getDeploymentTool('8.1');
deploymentTool.enumerateDevices()
- .then(function(deviceList) {
- deploymentTool.installAppPackage(TEST_APP_PACKAGE_NAME, deviceList[0], /*shouldLaunch*/ false, /*shouldUpdate*/ false);
- done();
- }).fail(function err (errMsg) {
- expect(errMsg).toBeUndefined();
- done();
- });
+ .then(function (deviceList) {
+ deploymentTool.installAppPackage(TEST_APP_PACKAGE_NAME, deviceList[0], /* shouldLaunch */ false, /* shouldUpdate */ false);
+ done();
+ }).fail(function err (errMsg) {
+ expect(errMsg).toBeUndefined();
+ done();
+ });
});
- it('Test #008 : installAppPackage passes the correct set of parameters when updating', function(done) {
+ it('Test #008 : installAppPackage passes the correct set of parameters when updating', function (done) {
var deploymentTool = deployment.getDeploymentTool('8.1');
deploymentTool.enumerateDevices()
- .then(function(deviceList) {
- deploymentTool.installAppPackage(TEST_APP_PACKAGE_NAME, deviceList[0], /*shouldLaunch*/ false, /*shouldUpdate*/ true);
- done();
- }).fail(function err (errMsg) {
- expect(errMsg).toBeUndefined();
- done();
- });
+ .then(function (deviceList) {
+ deploymentTool.installAppPackage(TEST_APP_PACKAGE_NAME, deviceList[0], /* shouldLaunch */ false, /* shouldUpdate */ true);
+ done();
+ }).fail(function err (errMsg) {
+ expect(errMsg).toBeUndefined();
+ done();
+ });
});
- it('Test #009 : installAppPackage passes the correct set of parameters when launching', function(done) {
+ it('Test #009 : installAppPackage passes the correct set of parameters when launching', function (done) {
var deploymentTool = deployment.getDeploymentTool('8.1');
deploymentTool.enumerateDevices()
- .then(function(deviceList) {
- deploymentTool.installAppPackage(TEST_APP_PACKAGE_NAME, deviceList[0], /*shouldLaunch*/ true, /*shouldUpdate*/ false);
- done();
- }).fail(function err (errMsg) {
- expect(errMsg).toBeUndefined();
- done();
- });
+ .then(function (deviceList) {
+ deploymentTool.installAppPackage(TEST_APP_PACKAGE_NAME, deviceList[0], /* shouldLaunch */ true, /* shouldUpdate */ false);
+ done();
+ }).fail(function err (errMsg) {
+ expect(errMsg).toBeUndefined();
+ done();
+ });
});
- it('Test #010 : installAppPackage passes the correct set of parameters when updating and launching', function(done) {
+ it('Test #010 : installAppPackage passes the correct set of parameters when updating and launching', function (done) {
var deploymentTool = deployment.getDeploymentTool('8.1');
deploymentTool.enumerateDevices()
- .then(function(deviceList) {
- deploymentTool.installAppPackage(TEST_APP_PACKAGE_NAME, deviceList[0], /*shouldLaunch*/ true, /*shouldUpdate*/ true);
- done();
- }).fail(function err (errMsg) {
- expect(errMsg).toBeUndefined();
- done();
- });
+ .then(function (deviceList) {
+ deploymentTool.installAppPackage(TEST_APP_PACKAGE_NAME, deviceList[0], /* shouldLaunch */ true, /* shouldUpdate */ true);
+ done();
+ }).fail(function err (errMsg) {
+ expect(errMsg).toBeUndefined();
+ done();
+ });
});
- it('Test #011 : uninstallAppPackage passes the correct set of parameters', function(done) {
+ it('Test #011 : uninstallAppPackage passes the correct set of parameters', function (done) {
var deploymentTool = deployment.getDeploymentTool('8.1');
deploymentTool.enumerateDevices()
- .then(function(deviceList) {
- deploymentTool.uninstallAppPackage(TEST_APP_PACKAGE_ID, deviceList[5]);
- done();
- }).fail(function err (errMsg) {
- expect(errMsg).toBeUndefined();
- done();
- });
+ .then(function (deviceList) {
+ deploymentTool.uninstallAppPackage(TEST_APP_PACKAGE_ID, deviceList[5]);
+ done();
+ }).fail(function err (errMsg) {
+ expect(errMsg).toBeUndefined();
+ done();
+ });
});
});
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org