cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject [02/16] cordova-lib git commit: tweaks to existing tests to get closer to having tests pass after removing lazy loading, including: - bump timeout on test that fetches/unpacks tarballs. also ensure failure cases invoke done so we dont wait in case error
Date Fri, 16 Jun 2017 00:19:56 GMT
tweaks to existing tests to get closer to having tests pass after
removing lazy loading, including:
- bump timeout on test that fetches/unpacks tarballs. also ensure failure cases invoke done
so we dont wait in case error conditions get hit.

- remove wrapper specs, leave todo on how to properly unit test.


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

Branch: refs/heads/master
Commit: 37120613749c6695a33cf9ea70d6c9f9e9ffbb2f
Parents: 74c113d
Author: filmaj <maj.fil@gmail.com>
Authored: Thu Jun 8 18:06:48 2017 -0500
Committer: filmaj <maj.fil@gmail.com>
Committed: Mon Jun 12 15:24:58 2017 -0500

----------------------------------------------------------------------
 .gitignore                       |  1 +
 spec-cordova/HooksRunner.spec.js | 11 ++++++-
 spec-cordova/wrappers.spec.js    | 60 ----------------------------------
 spec-plugman/wrappers.spec.js    | 61 -----------------------------------
 4 files changed, 11 insertions(+), 122 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/37120613/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index 1cba455..ee96fde 100644
--- a/.gitignore
+++ b/.gitignore
@@ -15,3 +15,4 @@ cordova-lib/src/plugman/defaults.json
 cordova-lib/spec-plugman/plugins/recursivePlug/demo/fetch.json
 cordova-lib/spec-plugman/plugins/recursivePlug/demo/test-recursive
 cordova-fetch/test/temp
+**/*.swp

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/37120613/spec-cordova/HooksRunner.spec.js
----------------------------------------------------------------------
diff --git a/spec-cordova/HooksRunner.spec.js b/spec-cordova/HooksRunner.spec.js
index e121ee3..ef28fa8 100644
--- a/spec-cordova/HooksRunner.spec.js
+++ b/spec-cordova/HooksRunner.spec.js
@@ -66,6 +66,13 @@ shell.chmod('-R', 'ug+x', hooksDir);
 shell.chmod('-R', 'ug+x', hooksDirDot);
 shell.chmod('-R', 'ug+x', scriptsDir);
 
+// To get more verbose output to help trace program flow, uncomment the lines below
+// TODO: think about how to factor this out so that it can be invoked from the command line
+//var events = require('cordova-common').events;
+//events.on('log', function(msg) { console.log(msg); });
+//events.on('verbose', function(msg) { console.log(msg); });
+//events.on('warn', function(msg) { console.log(msg); });
+
 describe('HooksRunner', function() {
     var hooksRunner;
     var hookOptions;
@@ -120,6 +127,7 @@ describe('HooksRunner', function() {
         // Add the testing platform.
         cordova.raw.platform('add', [helpers.testPlatform]).fail(function (err) {
             expect(err).toBeUndefined();
+            done();
         }).then(function () {
             // Add the testing plugin
             projectRoot = cordovaUtil.isCordova();
@@ -136,13 +144,14 @@ describe('HooksRunner', function() {
 
             cordova.raw.plugin('add', testPluginFixturePath).fail(function (err) {
                 expect(err && err.stack).toBeUndefined();
+                done();
             }).then(function () {
                 testPluginInstalledPath = path.join(projectRoot, 'plugins', 'com.plugin.withhooks');
                 shell.chmod('-R', 'ug+x', path.join(testPluginInstalledPath, 'scripts'));
                 done();
             });
         });
-    });
+    }, 100000);
 
     describe('fire method', function() {
         beforeEach(function() {

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/37120613/spec-cordova/wrappers.spec.js
----------------------------------------------------------------------
diff --git a/spec-cordova/wrappers.spec.js b/spec-cordova/wrappers.spec.js
deleted file mode 100644
index 9c6af7f..0000000
--- a/spec-cordova/wrappers.spec.js
+++ /dev/null
@@ -1,60 +0,0 @@
-/**
-    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.
-*/
-
-/* jshint loopfunc: true */
-
-var Q = require('q'),
-    cordova = require('../src/cordova/cordova');
-
-describe('callback wrapper', function() {
-    var calls = ['prepare', 'build', 'create', 'emulate', 'plugin', 'platform', 'compile',
'run'];
-    for (var i = 0; i < calls.length; i++) {
-        var call = calls[i];
-
-        describe('`' + call + '`', function() {
-            var raw;
-            beforeEach(function() {
-                raw = spyOn(cordova.raw, call);
-            });
-
-            it('Test 001 : should work with no callback and success', function() {
-                raw.and.returnValue(Q());
-                cordova[call]();
-                expect(raw).toHaveBeenCalled();
-            });
-
-            it('Test 002 : should call the callback on success', function(done) {
-                raw.and.returnValue(Q());
-                cordova[call](function(err) {
-                    expect(err).toBeUndefined();
-                    done();
-                });
-            });
-
-            it('Test 003 : should call the callback with the error on failure', function(done)
{
-                var err = new Error('junk');
-                raw.and.returnValue(Q.reject(err));
-                cordova[call](function(e) {
-                    expect(e).toEqual(err);
-                    done();
-                });
-            });
-        });
-    }
-});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/37120613/spec-plugman/wrappers.spec.js
----------------------------------------------------------------------
diff --git a/spec-plugman/wrappers.spec.js b/spec-plugman/wrappers.spec.js
deleted file mode 100644
index b5877f8..0000000
--- a/spec-plugman/wrappers.spec.js
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
-    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.
-*/
-
-/* jshint loopfunc:true */
-
-var Q = require('q'),
-    plugman = require('../src/plugman/plugman');
-
-describe('callback wrapper', function() {
-    var calls = ['install', 'uninstall', 'fetch', 'config', 'owner', 'adduser', 'publish',
'unpublish', 'search', 'info', 'create', 'platform'];
-    for (var i = 0; i < calls.length; i++) {
-        var call = calls[i];
-
-        describe('`' + call + '`', function() {
-            var raw;
-            beforeEach(function() {
-                raw = spyOn(plugman.raw, call);
-            });
-
-            it('Test 001 : should work with no callback and success', function() {
-                raw.and.returnValue(Q());
-                plugman[call]();
-                expect(raw).toHaveBeenCalled();
-            });
-
-            it('Test 002 : should call the callback on success', function(done) {
-                raw.and.returnValue(Q(1));
-                plugman[call](function(err) {
-                    expect(err).toBeUndefined();
-                    done();
-                });
-            });
-
-            it('Test 003 : should call the callback with the error on failure', function(done)
{
-                var err = new Error('junk');
-                raw.and.callFake(function() { return Q.reject(err); });
-                plugman[call](function(err) {
-                    expect(err).toEqual(err);
-                    done();
-                });
-            });
-        });
-    }
-});
-


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


Mime
View raw message