cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From purplecabbage <...@git.apache.org>
Subject [GitHub] cordova-lib pull request #562: Removing lazy load, platform command refactor...
Date Thu, 15 Jun 2017 22:30:42 GMT
Github user purplecabbage commented on a diff in the pull request:

    https://github.com/apache/cordova-lib/pull/562#discussion_r122328245
  
    --- Diff: spec-cordova/platform/index.spec.js ---
    @@ -0,0 +1,181 @@
    +/**
    +    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.
    +*/
    +/* eslint-env jasmine */
    +
    +var rewire = require('rewire');
    +var platform = rewire('../../src/cordova/platform');
    +var cordova_util = require('../../src/cordova/util');
    +
    +describe('cordova/platform', function () {
    +    var hooksRunnerRevert;
    +    var projectRoot = 'somepath';
    +    beforeEach(function () {
    +        // TODO: if we can change HooksRunner from a prototypal class to a function or
object,
    +        // we could eliminate the need for rewire here and use just jasmine spies.
    +        hooksRunnerRevert = platform.__set__('HooksRunner', function () {});
    +        spyOn(cordova_util, 'cdProjectRoot').and.returnValue(projectRoot);
    +    });
    +
    +    afterEach(function () {
    +        hooksRunnerRevert();
    +    });
    +
    +    describe('main module function', function () {
    +        describe('error/warning conditions', function () {
    +            // TODO: what about other commands? update? save?
    +            it('should require at least one platform for add and remove commands', function
(done) {
    +                // targets = empty array
    +                platform('add', []).then(function () {
    +                    fail('should not succeed without targets');
    +                }, function (err) {
    +                    expect(err).toMatch(/You need to qualify.* with one or more platforms/gi);
    --- End diff --
    
    I would suggest we defined error codes before we define static properties, and start by
manually looking things up.  But yeah, I'd consider this out of scope.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


Mime
View raw message