cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject [07/16] cordova-lib git commit: salvage real unit tests: - move actual unit tests from the old (mostly integration-test-heavy) platform.spec to new spec-cordova/platform.spec.js.
Date Fri, 16 Jun 2017 00:20:01 GMT
salvage real unit tests:
- move actual unit tests from the old (mostly integration-test-heavy) platform.spec to new
spec-cordova/platform.spec.js.

- moved the actual unit tests for cordova.platform out of the integration tests folder and
back into the spec folder.


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

Branch: refs/heads/master
Commit: 4c0432f0b1ec40fca5c2b403fa2fc4aec1d0d325
Parents: f16ad79
Author: filmaj <maj.fil@gmail.com>
Authored: Fri Jun 9 18:26:17 2017 -0500
Committer: filmaj <maj.fil@gmail.com>
Committed: Mon Jun 12 15:26:12 2017 -0500

----------------------------------------------------------------------
 integration-tests/platform.spec.js | 37 --------------------
 spec-cordova/platform.spec.js      | 61 +++++++++++++++++++++++++++++++++
 2 files changed, 61 insertions(+), 37 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/4c0432f0/integration-tests/platform.spec.js
----------------------------------------------------------------------
diff --git a/integration-tests/platform.spec.js b/integration-tests/platform.spec.js
index ae23178..fcda367 100644
--- a/integration-tests/platform.spec.js
+++ b/integration-tests/platform.spec.js
@@ -165,43 +165,6 @@ describe('platform end-to-end', function () {
     });
 });
 
-describe('add function', function () {
-    var opts;
-    var hooksRunnerMock;
-
-    beforeEach(function(){
-        opts = {};
-        hooksRunnerMock = {
-            fire: function () {
-                return Q();
-            }
-        };
-    });
-
-    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`.');
-            done();
-        });
-    });
-
-    it('Test 005 : throws if the target list is undefined or null', function (done) {
-
-        // case 1 : target list undefined
-        var targets; // = undefined;
-        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`.');
-        });
-
-        // case 2 : target list null
-        targets = null;
-        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`.');
-            done();
-        });
-    });
-});
 
 describe('platform add plugin rm end-to-end', function () {
 

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/4c0432f0/spec-cordova/platform.spec.js
----------------------------------------------------------------------
diff --git a/spec-cordova/platform.spec.js b/spec-cordova/platform.spec.js
new file mode 100644
index 0000000..5df16d9
--- /dev/null
+++ b/spec-cordova/platform.spec.js
@@ -0,0 +1,61 @@
+/**
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+    http://www.apache.org/licenses/LICENSE-2.0
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+*/
+
+var platform = require('../src/cordova/platform');
+var os = require('os');
+
+describe('cordova.platform', function() {
+    describe('add function', function () {
+        var opts;
+        var hooksRunnerMock;
+        var projectRoot = os.tmpdir();
+
+        beforeEach(function(){
+            opts = {};
+            projectRoot = 
+            hooksRunnerMock = {
+                fire: function () {
+                    return Q();
+                }
+            };
+        });
+
+        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`.');
+                done();
+            });
+        });
+
+        it('Test 005 : throws if the target list is undefined or null', function (done) {
+
+            // case 1 : target list undefined
+            var targets; // = undefined;
+            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`.');
+            });
+
+            // case 2 : target list null
+            targets = null;
+            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`.');
+                done();
+            });
+        });
+    });
+});


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


Mime
View raw message