You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by fi...@apache.org on 2013/04/24 01:01:02 UTC
[34/50] [abbrv] git commit: Added in remote plugin tests
Added in remote plugin tests
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/1d23f0a9
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/1d23f0a9
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/1d23f0a9
Branch: refs/heads/master
Commit: 1d23f0a92efa99aa9e0afac82f360be9241c4f9c
Parents: 5e1b502
Author: Tim Kim <ti...@adobe.com>
Authored: Mon Apr 22 16:12:38 2013 -0700
Committer: Tim Kim <ti...@adobe.com>
Committed: Mon Apr 22 16:13:00 2013 -0700
----------------------------------------------------------------------
spec/util/plugins.spec.js | 80 ++++++++++++++++++++++++++++++++++++++++
1 files changed, 80 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/1d23f0a9/spec/util/plugins.spec.js
----------------------------------------------------------------------
diff --git a/spec/util/plugins.spec.js b/spec/util/plugins.spec.js
index e69de29..8990955 100644
--- a/spec/util/plugins.spec.js
+++ b/spec/util/plugins.spec.js
@@ -0,0 +1,80 @@
+#!/usr/bin/env node
+/*
+ *
+ *
+ * Licensed 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.
+ *
+*/
+
+var http = require('http'),
+ osenv = require('osenv'),
+ path = require('path'),
+ fs = require('fs'),
+ temp = path.join(osenv.tmpdir(), 'plugman'),
+ shell = require('shelljs'),
+ plugins = require('../../src/util/plugins');
+
+describe('plugins', function(){
+ describe('server', function(){
+ it('should be able to retrieve information for an existing plugin', function(done){
+ plugins.getPluginInfo('ChildBrowser', function(error, plugin) {
+ expect(error).toBe(null);
+ expect(plugin).not.toBe(null);
+ expect(plugin.url).toBe('https://github.com/imhotep/ChildBrowser');
+ expect(plugin.name).toBe('ChildBrowser');
+ expect(plugin.description).toBe('ChildBrowser plugin');
+ done();
+ });
+ });
+
+ it('should error if searching for a non-existant plugin', function(done){
+ plugins.getPluginInfo('MEAT_POPSICLE', function(error, plugin) {
+ expect(error).not.toBe(null);
+ expect(error).toBe('Could not find information on MEAT_POPSICLE plugin');
+ done();
+ });
+ });
+
+ it('should list all plugins', function(done){
+ plugins.listAllPlugins(function(plugin){
+ expect(plugin).not.toBe(null);
+ expect(plugin.length).toBeGreaterThan(0);
+ done();
+ });
+ });
+
+ it('should be able to clone to local from url', function(done){
+ plugins.getPluginInfo('ChildBrowser', function(error, plugin) {
+ shell.mkdir('-p', temp);
+ plugins.clonePluginGitRepo(plugin.url, temp, function(error){
+ expect(error).toBe(null);
+ done();
+ });
+ shell.rm('-rf', temp);
+ });
+ });
+
+ it('should error if cloning a non-existant plugin', function(done){
+ shell.mkdir('-p', temp);
+ plugins.clonePluginGitRepo('MEAT_POPSICLE', temp, function(error){
+ expect(error).not.toBe(null);
+ done();
+ });
+ shell.rm('-rf', temp);
+ });
+ });
+});
+
+
+