cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lorinb...@apache.org
Subject [2/2] git commit: [CB-6292] tests for build function's dual return method
Date Mon, 17 Mar 2014 17:55:48 GMT
[CB-6292] tests for build function's dual return method


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

Branch: refs/heads/master
Commit: 60f5e8d72e4e1a1446780e308815e4b07080c73d
Parents: 9b7324a
Author: lorinbeer <lorin@adobe.com>
Authored: Mon Mar 17 10:52:42 2014 -0700
Committer: lorinbeer <lorin@adobe.com>
Committed: Mon Mar 17 10:52:42 2014 -0700

----------------------------------------------------------------------
 spec/build.spec.js | 34 +++++++++++++++++++++++++++++++++-
 1 file changed, 33 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/60f5e8d7/spec/build.spec.js
----------------------------------------------------------------------
diff --git a/spec/build.spec.js b/spec/build.spec.js
index 259c3d4..c4c58d8 100644
--- a/spec/build.spec.js
+++ b/spec/build.spec.js
@@ -78,9 +78,37 @@ describe('build command', function() {
         });
     });
 
+    describe('callback',function() {
+        var tag = false,
+            promise,
+            callback;
+
+        beforeEach(function () {
+            callback = function() {
+                tag = true;
+            }
+        });
+
+        it('should return null if a callback argument is supplied',function(){
+            var promise;
+           
+             promise = cordova.raw.build(['android','ios'], callback);
+             expect(promise).toBe(null);
+        });
+
+        it('should call the supplied callback if supplied', function() {
+            runs(function(){
+                cordova.raw.build(['android','ios'],callback);
+            });
+            waitsFor(function(){
+                return tag;
+            },10000);
+        });
+    });
+
     describe('success', function() {
         it('should run inside a Cordova-based project with at least one added platform and
call both prepare and compile', function(done) {
-            cordova.raw.build(['android','ios']).then(function() {
+           cordova.raw.build(['android','ios']).then(function() {
                 var opts = {verbose: false, platforms: ['android', 'ios'], options: []};
                 expect(prepare_spy).toHaveBeenCalledWith(opts);
                 expect(compile_spy).toHaveBeenCalledWith(opts);
@@ -97,6 +125,10 @@ describe('build command', function() {
         });
     });
 
+    describe('',function(){
+
+    });
+
     describe('hooks', function() {
         describe('when platforms are added', function() {
             it('should fire before hooks through the hooker module', function(done) {


Mime
View raw message