Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 6D707200CC3 for ; Sat, 10 Jun 2017 01:26:33 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 6B444160BDE; Fri, 9 Jun 2017 23:26:33 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 41842160BCA for ; Sat, 10 Jun 2017 01:26:32 +0200 (CEST) Received: (qmail 51432 invoked by uid 500); 9 Jun 2017 23:26:31 -0000 Mailing-List: contact commits-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list commits@cordova.apache.org Received: (qmail 51338 invoked by uid 99); 9 Jun 2017 23:26:31 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Jun 2017 23:26:31 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 42C98F4A47; Fri, 9 Jun 2017 23:26:30 +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: Fri, 09 Jun 2017 23:26:45 -0000 Message-Id: <2305ced5307e40fba8d4c1aed0db7a60@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [17/17] cordova-lib git commit: move actual unit tests from the old (mostly integration-test-heavy) platform.spec to new spec-cordova/platform.spec.js. archived-at: Fri, 09 Jun 2017 23:26:33 -0000 move actual unit tests from the old (mostly integration-test-heavy) platform.spec to new spec-cordova/platform.spec.js. Project: http://git-wip-us.apache.org/repos/asf/cordova-lib/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-lib/commit/4b772eaf Tree: http://git-wip-us.apache.org/repos/asf/cordova-lib/tree/4b772eaf Diff: http://git-wip-us.apache.org/repos/asf/cordova-lib/diff/4b772eaf Branch: refs/heads/no-lazy-load Commit: 4b772eafda89be2b85789fd10e9025a2d73168b7 Parents: b8b1013 Author: filmaj Authored: Fri Jun 9 18:26:17 2017 -0500 Committer: filmaj Committed: Fri Jun 9 18:26:17 2017 -0500 ---------------------------------------------------------------------- spec-cordova/platform.spec.js | 61 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/4b772eaf/spec-cordova/platform.spec.js ---------------------------------------------------------------------- diff --git a/spec-cordova/platform.spec.js b/spec-cordova/platform.spec.js new file mode 100644 index 0000000..5df16d9 --- /dev/null +++ b/spec-cordova/platform.spec.js @@ -0,0 +1,61 @@ +/** + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you 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 platform = require('../src/cordova/platform'); +var os = require('os'); + +describe('cordova.platform', function() { + describe('add function', function () { + var opts; + var hooksRunnerMock; + var projectRoot = os.tmpdir(); + + beforeEach(function(){ + opts = {}; + projectRoot = + hooksRunnerMock = { + fire: function () { + return Q(); + } + }; + }); + + it('Test 004 : throws if the target list is empty', function (done) { + var targets = []; + platform.add(hooksRunnerMock, projectRoot, targets, opts).fail(function (error) { + expect(error.message).toBe('No platform specified. Please specify a platform to add. See `cordova platform list`.'); + done(); + }); + }); + + it('Test 005 : throws if the target list is undefined or null', function (done) { + + // case 1 : target list undefined + var targets; // = undefined; + platform.add(hooksRunnerMock, projectRoot, targets, opts).fail(function (error) { + expect(error.message).toBe('No platform specified. Please specify a platform to add. See `cordova platform list`.'); + }); + + // case 2 : target list null + targets = null; + platform.add(hooksRunnerMock, projectRoot, targets, opts).fail(function (error) { + expect(error.message).toBe('No platform specified. Please specify a platform to add. See `cordova platform list`.'); + done(); + }); + }); + }); +}); --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org For additional commands, e-mail: commits-help@cordova.apache.org