Return-Path: X-Original-To: apmail-cordova-commits-archive@www.apache.org Delivered-To: apmail-cordova-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3E22410C77 for ; Tue, 23 Apr 2013 23:00:34 +0000 (UTC) Received: (qmail 44958 invoked by uid 500); 23 Apr 2013 23:00:32 -0000 Delivered-To: apmail-cordova-commits-archive@cordova.apache.org Received: (qmail 44900 invoked by uid 500); 23 Apr 2013 23:00:32 -0000 Mailing-List: contact commits-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: callback-dev@cordova.apache.org Delivered-To: mailing list commits@cordova.apache.org Received: (qmail 44484 invoked by uid 99); 23 Apr 2013 23:00:31 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 23 Apr 2013 23:00:31 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 78B98823628; Tue, 23 Apr 2013 23:00:31 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: filmaj@apache.org To: commits@cordova.apache.org Date: Tue, 23 Apr 2013 23:01:02 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [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 Authored: Mon Apr 22 16:12:38 2013 -0700 Committer: Tim Kim 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); + }); + }); +}); + + +