move actual unit tests from the old (mostly integration-test-heavy) 
platform.spec to new spec-cordova/platform.spec.js.


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

Branch: refs/heads/no-lazy-load
Commit: 4b772eafda89be2b85789fd10e9025a2d73168b7
Parents: b8b1013
Author: filmaj <maj....@gmail.com>
Authored: Fri Jun 9 18:26:17 2017 -0500
Committer: filmaj <maj....@gmail.com>
Committed: Fri Jun 9 18:26:17 2017 -0500

----------------------------------------------------------------------
 spec-cordova/platform.spec.js | 61 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 61 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/4b772eaf/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-unsubscr...@cordova.apache.org
For additional commands, e-mail: commits-h...@cordova.apache.org

Reply via email to