cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jso...@apache.org
Subject [2/2] webworks commit: CB-7209 Improve tests including adding parallelism support
Date Tue, 29 Jul 2014 00:41:08 GMT
CB-7209 Improve tests including adding parallelism support


Project: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/commit/c94d8ca4
Tree: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/tree/c94d8ca4
Diff: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/diff/c94d8ca4

Branch: refs/heads/master
Commit: c94d8ca45b294c3d62deb7064d3ff926dd605b6c
Parents: da6a1d3
Author: Josh Soref <jsoref@blackberry.com>
Authored: Mon Jul 28 20:27:16 2014 -0400
Committer: Josh Soref <jsoref@blackberry.com>
Committed: Mon Jul 28 20:40:05 2014 -0400

----------------------------------------------------------------------
 bin/test/cordova/integration/create.js          | 24 ++++++++++----------
 bin/test/cordova/integration/target.js          | 10 ++++----
 bin/test/cordova/unit/spec/lib/cmdline.js       |  2 +-
 .../cordova/unit/spec/lib/native-packager.js    |  2 +-
 .../cordova/unit/spec/lib/signing-helper.js     |  7 +++---
 bin/test/cordova/unit/spec/lib/signing-utils.js |  8 ++++++-
 6 files changed, 30 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/c94d8ca4/bin/test/cordova/integration/create.js
----------------------------------------------------------------------
diff --git a/bin/test/cordova/integration/create.js b/bin/test/cordova/integration/create.js
index b308f0e..c5bb3e2 100644
--- a/bin/test/cordova/integration/create.js
+++ b/bin/test/cordova/integration/create.js
@@ -18,15 +18,15 @@
 */
 
 var childProcess = require('child_process'),
-    tempFolder = '.tmp/',
-    appFolder = tempFolder + 'tempCordovaApp/',
+    path = require('path'),
+    tempFolder = '.tmp'+Date.now(),
+    appFolder = path.join(tempFolder, 'tempCordovaApp'),
     wrench = require('wrench'),
     utils = require('../../../templates/project/cordova/lib/utils'),
-    path = require('path'),
     fs = require('fs'),
     shell = require("shelljs"),
     _output = "",
-    CREATE_COMMAND = path.normalize(__dirname + "/../../../create") + (utils.isWindows()
? ".bat" : "");
+    CREATE_COMMAND = path.normalize(path.join(__dirname, "..", "..", "..", "create")) + (utils.isWindows()
? ".bat" : "");
 
 function executeScript(shellCommand, args, shouldError) {
     var strCommand = "\"" + shellCommand + "\" " + args.join(" "),
@@ -46,13 +46,13 @@ describe("create tests", function () {
             wrench.rmdirSyncRecursive(tempFolder);
         }
         executeScript(CREATE_COMMAND, [appFolder]);
-        expect(appIdRegExp.test(fs.readFileSync(appFolder + "www/config.xml", "utf-8"))).toEqual(true);
+        expect(appIdRegExp.test(fs.readFileSync(path.join(appFolder, "www", "config.xml"),
"utf-8"))).toEqual(true);
         expect(fs.existsSync(appFolder)).toEqual(true);
-        expect(fs.existsSync(appFolder + "/cordova")).toEqual(true);
-        expect(fs.existsSync(appFolder + "/cordova/node_modules")).toEqual(true);
-        expect(fs.existsSync(appFolder + "/cordova/lib")).toEqual(true);
-        expect(fs.existsSync(appFolder + "/cordova/third_party")).toEqual(true);
-        expect(fs.existsSync(appFolder + "/www")).toEqual(true);
+        expect(fs.existsSync(path.join(appFolder, "cordova"))).toEqual(true);
+        expect(fs.existsSync(path.join(appFolder, "cordova", "node_modules"))).toEqual(true);
+        expect(fs.existsSync(path.join(appFolder, "cordova", "lib"))).toEqual(true);
+        expect(fs.existsSync(path.join(appFolder, "cordova", "third_party"))).toEqual(true);
+        expect(fs.existsSync(path.join(appFolder, "www"))).toEqual(true);
         expect(fs.existsSync("./build")).toEqual(false);
         this.after(function () {
             wrench.rmdirSyncRecursive(tempFolder);
@@ -64,7 +64,7 @@ describe("create tests", function () {
             appIdRegExp = /id="com\.example\.bb10app"/g;
 
         executeScript(CREATE_COMMAND, [appFolder, "com.example.bb10app"]);
-        expect(appIdRegExp.test(fs.readFileSync(appFolder + "www/config.xml", "utf-8"))).toEqual(true);
+        expect(appIdRegExp.test(fs.readFileSync(path.join(appFolder, "www", "config.xml"),
"utf-8"))).toEqual(true);
         this.after(function () {
             wrench.rmdirSyncRecursive(tempFolder);
         });
@@ -73,7 +73,7 @@ describe("create tests", function () {
     it("sets appId and barName", function () {
         var appIdRegExp = /id="com\.example\.bb10app"/g;
         executeScript(CREATE_COMMAND, [appFolder, "com.example.bb10app", "bb10appV1"]);
-        expect(appIdRegExp.test(fs.readFileSync(appFolder + "www/config.xml", "utf-8"))).toEqual(true);
+        expect(appIdRegExp.test(fs.readFileSync(path.join(appFolder, "www", "config.xml"),
"utf-8"))).toEqual(true);
         this.after(function () {
             wrench.rmdirSyncRecursive(tempFolder);
         });

http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/c94d8ca4/bin/test/cordova/integration/target.js
----------------------------------------------------------------------
diff --git a/bin/test/cordova/integration/target.js b/bin/test/cordova/integration/target.js
index 5da16a3..dc1a8e2 100644
--- a/bin/test/cordova/integration/target.js
+++ b/bin/test/cordova/integration/target.js
@@ -18,19 +18,19 @@
 */
 
 var childProcess = require('child_process'),
-    tempFolder = '.tmp/',
-    appFolder = tempFolder + 'tempCordovaApp/',
+    path = require('path'),
+    tempFolder = '.tmp'+Date.now(),
+    appFolder = path.join(tempFolder, 'tempCordovaApp'),
     wrench = require('wrench'),
     utils = require('../../../templates/project/cordova/lib/utils'),
     fs = require('fs'),
-    path = require('path'),
     shell = require("shelljs"),
     configPath = utils.getPropertiesFilePath(),
     testAppCreated = false,
     _output = "",
     _code,
-    CREATE_COMMAND = path.normalize(__dirname + "/../../../create") + (utils.isWindows()
? ".bat" : ""),
-    TARGET_COMMAND = path.normalize(appFolder + "cordova/target") + (utils.isWindows() ?
".bat" : "");
+    CREATE_COMMAND = path.normalize(path.join(__dirname, "..", "..", "..", "create")) + (utils.isWindows()
? ".bat" : ""),
+    TARGET_COMMAND = path.normalize(path.join(appFolder, "cordova", "target")) + (utils.isWindows()
? ".bat" : "");
 
 function executeScript(shellCommand, args, shouldFail) {
     var strCommand = "\"" + shellCommand + "\" " + args.join(" "),

http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/c94d8ca4/bin/test/cordova/unit/spec/lib/cmdline.js
----------------------------------------------------------------------
diff --git a/bin/test/cordova/unit/spec/lib/cmdline.js b/bin/test/cordova/unit/spec/lib/cmdline.js
index 421a95b..cff6088 100644
--- a/bin/test/cordova/unit/spec/lib/cmdline.js
+++ b/bin/test/cordova/unit/spec/lib/cmdline.js
@@ -27,7 +27,7 @@ var srcPath = __dirname + "/../../../../../templates/project/cordova/lib/",
 describe("Command line", function () {
     beforeEach(function () {
         cmd = cmdline
-                .parse(process.argv)
+                .parse([])
                 .commander;
     });
 

http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/c94d8ca4/bin/test/cordova/unit/spec/lib/native-packager.js
----------------------------------------------------------------------
diff --git a/bin/test/cordova/unit/spec/lib/native-packager.js b/bin/test/cordova/unit/spec/lib/native-packager.js
index 6f2359d..e3b20ef 100644
--- a/bin/test/cordova/unit/spec/lib/native-packager.js
+++ b/bin/test/cordova/unit/spec/lib/native-packager.js
@@ -336,7 +336,7 @@ describe("Native packager", function () {
         var cmd = "blackberry-nativepackager" + (pkgrUtils.isWindows() ? ".bat" : "");
         spyOn(pkgrUtils, "writeFile");
 
-        session.getParams = jasmine.createSpy("session getParams").andReturn({
+        spyOn(session, "getParams").andReturn({
             "-installApp": "",
             "-device": "192.168.1.114",
             "-password": "abc"

http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/c94d8ca4/bin/test/cordova/unit/spec/lib/signing-helper.js
----------------------------------------------------------------------
diff --git a/bin/test/cordova/unit/spec/lib/signing-helper.js b/bin/test/cordova/unit/spec/lib/signing-helper.js
index 8618f21..eb32e40 100644
--- a/bin/test/cordova/unit/spec/lib/signing-helper.js
+++ b/bin/test/cordova/unit/spec/lib/signing-helper.js
@@ -65,9 +65,10 @@ describe("signing-helper", function () {
             var callback = jasmine.createSpy("callback"),
                 cmd = "blackberry-signer";
 
-            session.getParams = jasmine.createSpy("session getParams").andReturn(null);
+            spyOn(session, "getParams").andReturn(null);
             signingHelper.execSigner(session, "device", callback);
-            expect(childProcess.exec).toHaveBeenCalledWith([cmd, "-keystore", session.keystore,
"-storepass", session.storepass, path.resolve("c:/device/Demo.bar")].join(" "), jasmine.any(Object),
callback);
+            expect(childProcess.exec.mostRecentCall.args[0]).toMatch(RegExp([cmd, "-keystore",
session.keystore, "-storepass", session.storepass, path.resolve("c:/device/Demo.bar")].join("
")));
+            expect(childProcess.exec.mostRecentCall.args[2]).toBe(callback);
             expect(stdoutOn).toHaveBeenCalledWith("data", pkgrUtils.handleProcessOutput);
             expect(stderrOn).toHaveBeenCalledWith("data", pkgrUtils.handleProcessOutput);
         });
@@ -76,7 +77,7 @@ describe("signing-helper", function () {
             var callback = jasmine.createSpy("callback"),
                 cmd = "blackberry-signer";
 
-            session.getParams = jasmine.createSpy("session getParams").andReturn({
+            spyOn(session, "getParams").andReturn({
                 "-proxyhost": "abc.com",
                 "-proxyport": "80"
             });

http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/c94d8ca4/bin/test/cordova/unit/spec/lib/signing-utils.js
----------------------------------------------------------------------
diff --git a/bin/test/cordova/unit/spec/lib/signing-utils.js b/bin/test/cordova/unit/spec/lib/signing-utils.js
index 1ba5c01..000086d 100644
--- a/bin/test/cordova/unit/spec/lib/signing-utils.js
+++ b/bin/test/cordova/unit/spec/lib/signing-utils.js
@@ -28,7 +28,13 @@ var testData = require('./test-data'),
 
 describe("signing-utils", function () {
 
-    describe("on windows", function () {
+    function wdescribe() {
+        if (os.platform() === "win32")
+            return describe;
+        return xdescribe;
+    }
+
+    wdescribe()("on windows", function () {
 
         beforeEach(function () {
 


Mime
View raw message