cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fil...@apache.org
Subject [1/5] git commit: [CB-4077] Fix tests for cordova-cli
Date Fri, 12 Jul 2013 03:58:33 GMT
Updated Branches:
  refs/heads/master 8cc97ef38 -> f204db813


[CB-4077] Fix tests for cordova-cli


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

Branch: refs/heads/master
Commit: cd18d4c56c7f92b7bd08174f0c94bc6a71cda9d7
Parents: 15fb308
Author: Ian Clelland <iclelland@chromium.org>
Authored: Mon Jul 8 14:08:58 2013 -0400
Committer: Fil Maj <maj.fil@gmail.com>
Committed: Thu Jul 11 20:45:26 2013 -0700

----------------------------------------------------------------------
 spec/plugin.spec.js | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/cd18d4c5/spec/plugin.spec.js
----------------------------------------------------------------------
diff --git a/spec/plugin.spec.js b/spec/plugin.spec.js
index f340151..ddd9b59 100644
--- a/spec/plugin.spec.js
+++ b/spec/plugin.spec.js
@@ -33,7 +33,7 @@ var project_dir = path.join('some','path');
 var plugins_dir = path.join(project_dir, 'plugins');
 
 describe('plugin command', function() {
-    var is_cordova, list_platforms, fire, find_plugins, rm, mkdir, existsSync, exec, prep_spy,
plugman_install, plugman_fetch, parsers = {}, uninstall;
+    var is_cordova, list_platforms, fire, find_plugins, rm, mkdir, existsSync, exec, prep_spy,
plugman_install, plugman_fetch, parsers = {}, uninstallPlatform, uninstallPlugin;
     beforeEach(function() {
         is_cordova = spyOn(util, 'isCordova').andReturn(project_dir);
         fire = spyOn(hooker.prototype, 'fire').andCallFake(function(e, opts, cb) {
@@ -61,7 +61,10 @@ describe('plugin command', function() {
         });
         plugman_install = spyOn(plugman, 'install');
         plugman_fetch = spyOn(plugman, 'fetch').andCallFake(function(target, plugins_dir,
opts, cb) { cb(false, path.join(plugins_dir, target)); });
-        uninstall = spyOn(plugman, 'uninstall');
+        uninstallPlatform = spyOn(plugman.uninstall, 'uninstallPlatform');
+        uninstallPlugin = spyOn(plugman.uninstall, 'uninstallPlugin').andCallFake(function(target,
plugins_dir, cb) {
+            cb && cb();
+        });
     });
 
     describe('failure', function() {
@@ -141,14 +144,19 @@ describe('plugin command', function() {
                 }).toThrow('Plugin "somethingrandom" not added to project.');
             });
 
-            it('should call plugman.uninstall for every matching installedplugin-supportedplatform
pair', function() {
+            it('should call plugman.uninstall.uninstallPlatform for every matching installedplugin-supportedplatform
pair', function() {
                 cordova.plugin('rm', sample_plugins);
                 sample_plugins.forEach(function(plug) {
                     subset.forEach(function(plat) {
-                        expect(uninstall).toHaveBeenCalledWith(plat, path.join(project_dir,
'platforms', plat), plug, plugins_dir, jasmine.any(Object));
+                        expect(uninstallPlatform).toHaveBeenCalledWith(plat, path.join(project_dir,
'platforms', plat), plug, plugins_dir, jasmine.any(Object));
                     });
                 });
             });
+            it('should call plugman.uninstall.uninstallPlugin once for every removed plugin',
function() {
+                uninstallPlugin.reset();
+                cordova.plugin('rm', sample_plugins);
+                expect(uninstallPlugin.callCount).toBe(2);
+            });
         });
     });
     describe('hooks', function() {


Mime
View raw message