CB-10641 Adds tests for order of operations in platform add

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

Branch: refs/heads/common-1.1.x
Commit: b04db5feaf5516836c8a157cc3331b75d6dca0eb
Parents: 3b9face
Author: Vladimir Kotikov <v-vlk...@microsoft.com>
Authored: Thu Feb 18 13:08:47 2016 +0300
Committer: Vladimir Kotikov <v-vlk...@microsoft.com>
Committed: Thu Feb 18 13:09:02 2016 +0300

----------------------------------------------------------------------
 cordova-lib/spec-cordova/platform.spec.js | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b04db5fe/cordova-lib/spec-cordova/platform.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/platform.spec.js 
b/cordova-lib/spec-cordova/platform.spec.js
index de3631a..2c99b4a 100644
--- a/cordova-lib/spec-cordova/platform.spec.js
+++ b/cordova-lib/spec-cordova/platform.spec.js
@@ -26,6 +26,7 @@ var helpers = require('./helpers'),
     Q = require('q'),
     events = require('cordova-common').events,
     cordova = require('../src/cordova/cordova'),
+    plugman = require('../src/plugman/plugman'),
     rewire = require('rewire'),
     platform = rewire('../src/cordova/platform.js');
 
@@ -132,9 +133,6 @@ describe('platform end-to-end', function () {
         .then(function() {
             return cordova.raw.platform('add', [helpers.testPlatform]);
         })
-        .then(function () {
-            return cordova.raw.prepare([helpers.testPlatform]);
-        })
         .then(function() {
             // Check the platform add was successful.
             expect(path.join(project, 'platforms', 
helpers.testPlatform)).toExist();
@@ -146,6 +144,24 @@ describe('platform end-to-end', function () {
         })
         .fin(done);
     });
+
+    it('should call prepare after plugins were installed into platform', 
function(done) {
+        var order = '';
+        var fail = jasmine.createSpy(fail);
+        spyOn(plugman.raw, 'install').andCallFake(function() { order += 'I'; 
});
+        spyOn(cordova.raw, 'prepare').andCallFake(function() { order += 'P'; 
});
+
+        cordova.raw.plugin('add', path.join(pluginsDir, 'test'))
+        .then(function() {
+            return cordova.raw.platform('add', [helpers.testPlatform]);
+        })
+        .fail(fail)
+        .fin(function() {
+            expect(order).toBe('IP'); // Install first, then prepare
+            expect(fail).not.toHaveBeenCalled();
+            done();
+        });
+    });
 });
 
 describe('add function', function () {


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

Reply via email to