cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CB-12361) Speed up cordova-lib tests
Date Thu, 27 Jul 2017 00:44:02 GMT

    [ https://issues.apache.org/jira/browse/CB-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16102532#comment-16102532
] 

ASF GitHub Bot commented on CB-12361:
-------------------------------------

Github user stevengill commented on a diff in the pull request:

    https://github.com/apache/cordova-lib/pull/577#discussion_r129730654
  
    --- Diff: spec/cordova/platform/list.spec.js ---
    @@ -0,0 +1,66 @@
    +/**
    +    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 events = require('cordova-common').events;
    +var Q = require('q');
    +var events = require('cordova-common').events;
    +var rewire = require('rewire');
    +var platform_list = rewire('../../../src/cordova/platform/list');
    +var platform_metadata = require('../../../src/cordova/platform_metadata');
    +var cordova_util = require('../../../src/cordova/util');
    +var fail;
    +
    +describe('cordova/platform/list', function () {
    +    var hooks_mock;
    +    var projectRoot = '/some/path';
    +
    +    beforeEach(function () {
    +        hooks_mock = jasmine.createSpyObj('hooksRunner mock', ['fire']);
    +        hooks_mock.fire.and.returnValue(Q());
    +        spyOn(cordova_util, 'getInstalledPlatformsWithVersions').and.callThrough();
    +        spyOn(events, 'emit');
    +        spyOn(platform_metadata, 'save');
    +        spyOn(cordova_util, 'requireNoCache').and.returnValue({});
    +    });
    +
    +    it('should fire the before_platform_ls hook', function () {
    +        platform_list(hooks_mock, projectRoot, {save : true});
    +        expect(hooks_mock.fire).toHaveBeenCalledWith('before_platform_ls', Object({ save:
true }));
    +    });
    +
    +    it('should file the after_platform_ls hook',function (done) {
    +        platform_list(hooks_mock, projectRoot, {save : true})
    +        .then(function(result) {
    +            expect(hooks_mock.fire).toHaveBeenCalledWith('after_platform_ls', Object({
save: true }));
    +        }).fail(function (err) {
    +            console.log(err.message);
    +            fail('unexpected failure handler invoked!');
    +            console.error(err);
    +        }).done(done);
    +    });
    +
    +    it('should print results of available platforms',function (done) {
    +        platform_list(hooks_mock, projectRoot, {save : true})
    +        .then(function(result) {
    +            expect(events.emit).toHaveBeenCalledWith('results', jasmine.stringMatching(/Installed
platforms:/));
    +        }).fail(function (err) {
    +            console.log(err.message);
    --- End diff --
    
    I don't think your fail function should `console.log(err.message)` and `console.log(err)`.
Just `console.log(err)` is sufficient. 


> Speed up cordova-lib tests
> --------------------------
>
>                 Key: CB-12361
>                 URL: https://issues.apache.org/jira/browse/CB-12361
>             Project: Apache Cordova
>          Issue Type: Improvement
>          Components: cordova-lib
>            Reporter: Steve Gill
>            Assignee: Steve Gill
>              Labels: cordova-next
>
> * Split out e2e tests into own folder
> * stub i/o and network requests
> * use local fixtures when possible & makes sense



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

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


Mime
View raw message