You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ja...@apache.org on 2018/02/07 15:57:58 UTC

[cordova-windows] 04/16: extrat file and subdir+file expect code into function

This is an automated email from the ASF dual-hosted git repository.

janpio pushed a commit to branch janpio-CB-13829
in repository https://gitbox.apache.org/repos/asf/cordova-windows.git

commit 92c48ca2fa15b501a7cf7bbf67fea4c133df0a4d
Author: Jan Piotrowski <pi...@gmail.com>
AuthorDate: Thu Jan 25 16:52:09 2018 +0100

    extrat file and subdir+file expect code into function
---
 spec/e2e/endtoend.spec.js | 33 ++++++++++++++++++++++-----------
 1 file changed, 22 insertions(+), 11 deletions(-)

diff --git a/spec/e2e/endtoend.spec.js b/spec/e2e/endtoend.spec.js
index 1f803a1..f4b8bd0 100644
--- a/spec/e2e/endtoend.spec.js
+++ b/spec/e2e/endtoend.spec.js
@@ -42,6 +42,17 @@ describe('Cordova create and build', function () {
         expect(packages.filter(function (file) { return file.match(fileName); }).length).toBe(1);
     }
 
+    function _expectExist(fileNamePattern) {
+        var packages = shell.ls(appPackagesFolder);
+        expect(packages.filter(function (file) { return file.match(fileNamePattern); }).length).toBe(1);
+    }
+
+    function _expectSubdirAndFileExist(subDirName, fileName) {
+        var packages = shell.ls(appPackagesFolder);
+        _expectExist(subDirName);
+        verifySubDirContainsFile(subDirName, fileName);
+    }
+
     beforeEach(function () {
         shell.exec(path.join('bin', 'create') + ' "' + projectFolder + '" com.test.app 応用', {silent: silent});
     });
@@ -55,28 +66,28 @@ describe('Cordova create and build', function () {
         expect(fs.existsSync(projectFolder)).toBe(true);
     });
 
-    // default build
+    // default
     
-    it('spec.2a should build default (win10) project', function () {
+    it('spec.2 should build default (win10) project', function () {
         shell.exec(buildScriptPath + '', {silent: silent});
-        var packages = shell.ls(appPackagesFolder);
-        var subDir = 'CordovaApp.Windows10_1.0.0.0_anycpu_debug_Test';
-        expect(packages.filter(function (file) { return file.match(subDir); }).length).toBe(1);
-        verifySubDirContainsFile(subDir, 'CordovaApp.Windows10_1.0.0.0_anycpu_debug.appx');
+        _expectSubdirAndFileExist('CordovaApp.Windows10_1.0.0.0_anycpu_debug_Test', 'CordovaApp.Windows10_1.0.0.0_anycpu_debug.appx');
     });
 
-    // --appx 8.1
+    // --appx
+
+    it('spec.2a should build win10 project', function () {
+        shell.exec(buildScriptPath + ' --appx=uap', {silent: silent});
+        _expectSubdirAndFileExist('CordovaApp.Windows10_1.0.0.0_anycpu_debug_Test', 'CordovaApp.Windows10_1.0.0.0_anycpu_debug.appx');
+    });
 
     it('spec.2b should build 8.1 win project', function () {
         shell.exec(buildScriptPath + ' --appx=8.1-win', {silent: silent});
-        var packages = shell.ls(appPackagesFolder);
-        expect(packages.filter(function (file) { return file.match(/.*Windows.*\.appxupload/); }).length).toBe(1);
+        _expectExist(/.*Windows.*\.appxupload/);
     });
 
     it('spec.2c should build 8.1 phone project', function () {
         shell.exec(buildScriptPath + ' --appx=8.1-phone', {silent: silent});
-        var packages = shell.ls(appPackagesFolder);
-        expect(packages.filter(function (file) { return file.match(/.*Phone.*\.appxupload*/); }).length).toBe(1);
+        _expectExist(/.*Phone.*\.appxupload/);
     });
 
     // --archs

-- 
To stop receiving notification emails like this one, please contact
janpio@apache.org.

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org