You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by an...@apache.org on 2015/07/29 12:46:04 UTC

cordova-lib git commit: CB-9421 Added a test for plugin fetch with searchpath parameter

Repository: cordova-lib
Updated Branches:
  refs/heads/master 10ec5b610 -> 6f494a271


CB-9421 Added a test for plugin fetch with searchpath parameter


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

Branch: refs/heads/master
Commit: 6f494a271761eef9abbb287967b882924382883b
Parents: 10ec5b6
Author: alsorokin <al...@akvelon.com>
Authored: Wed Jul 29 12:41:13 2015 +0300
Committer: alsorokin <al...@akvelon.com>
Committed: Wed Jul 29 12:41:37 2015 +0300

----------------------------------------------------------------------
 cordova-lib/spec-plugman/fetch.spec.js | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/6f494a27/cordova-lib/spec-plugman/fetch.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/fetch.spec.js b/cordova-lib/spec-plugman/fetch.spec.js
index cfc3104..07ef0bd 100644
--- a/cordova-lib/spec-plugman/fetch.spec.js
+++ b/cordova-lib/spec-plugman/fetch.spec.js
@@ -16,7 +16,8 @@
     specific language governing permissions and limitations
     under the License.
 */
-var fetch   = require('../src/plugman/fetch'),
+var rewire  = require('rewire'),
+    fetch   = rewire('../src/plugman/fetch'),
     fs      = require('fs'),
     os      = require('osenv'),
     path    = require('path'),
@@ -26,6 +27,7 @@ var fetch   = require('../src/plugman/fetch'),
     metadata = require('../src/plugman/util/metadata'),
     temp    = path.join(os.tmpdir(), 'plugman', 'fetch'),
     test_plugin = path.join(__dirname, 'plugins', 'org.test.plugins.childbrowser'),
+    test_plugin_searchpath = path.join(test_plugin, '..'),
     //test_plugin_with_space = path.join(__dirname, 'folder with space', 'plugins', 'org.test.plugins.childbrowser'),
     //test_plugin_xml = xml_helpers.parseElementtreeSync(path.join(test_plugin, 'plugin.xml')),
     test_plugin_id = 'org.test.plugins.childbrowser',
@@ -65,6 +67,7 @@ describe('fetch', function() {
             cp = spyOn(shell, 'cp').andCallThrough();
             save_metadata = spyOn(metadata, 'save_fetch_metadata');
             realrm('-rf', temp);
+            fetch.__set__('localPlugins', null);
         });
 
         it('should copy locally-available plugin to plugins directory', function(done) {
@@ -72,6 +75,11 @@ describe('fetch', function() {
                 expect(cp).toHaveBeenCalledWith('-R', path.join(test_plugin, '*'), path.join(temp, test_plugin_id));
             });
         });
+        it('should copy locally-available plugin to plugins directory when adding a plugin with searchpath argument', function(done) {
+            wrapper(fetch(test_plugin_id, temp, { searchpath: test_plugin_searchpath }), done, function() {
+                expect(cp).toHaveBeenCalledWith('-R', path.join(test_plugin, '*'), path.join(temp, test_plugin_id));
+            });
+        });
         it('should create a symlink if used with `link` param', function(done) {
             wrapper(fetch(test_plugin, temp, { link: true }), done, function() {
                 expect(sym).toHaveBeenCalledWith(test_plugin, path.join(temp, test_plugin_id), 'dir');


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