cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stevengill <...@git.apache.org>
Subject [GitHub] cordova-lib pull request #510: Fixjasmine : CB:12018 - updating tests in cor...
Date Wed, 11 Jan 2017 02:30:17 GMT
Github user stevengill commented on a diff in the pull request:

    https://github.com/apache/cordova-lib/pull/510#discussion_r95500869
  
    --- Diff: cordova-lib/spec-cordova/plugin.spec.js ---
    @@ -216,91 +229,110 @@ describe('plugin end-to-end', function() {
                 expect(defaultPluginPreferences.REQUIRED).toBe('NO');
                 return removePlugin(org_test_defaultvariables);
            })
    -       .fail(errorHandler.errorCallback)
    -       .fin(done);
    -    });
    +        .fail(function(err) {
    +            console.error(err);
    +            expect(err).toBeUndefined();
    +        })
    +        .fin(done);
    +    }, 30000);
     
    -    it('should successfully add a plugin when specifying CLI variables', function(done)
{
    +    it('Test 006 : should successfully add a plugin when specifying CLI variables', function(done)
{
             addPlugin(path.join(pluginsDir, org_test_defaultvariables), org_test_defaultvariables,
{cli_variables: { REQUIRED:'yes', REQUIRED_ANDROID:'yes'}}, done)
    -        .fail(errorHandler.errorCallback)
    +        .fail(function(err) {
    +            console.error(err);
    +            expect(err).toBeUndefined();
    +        })
             .fin(done);
    -    });
    +    }, 30000);
     
    -    it('should not check npm info when using the searchpath flag', function(done) {
    +    it('Test 007 : should not check npm info when using the searchpath flag', function(done)
{
             mockPluginFetch(npmInfoTestPlugin, path.join(pluginsDir, npmInfoTestPlugin));
    -
             spyOn(registry, 'info');
    -        addPlugin(npmInfoTestPlugin, npmInfoTestPlugin, {searchpath: pluginsDir}, done)
    +        return addPlugin(npmInfoTestPlugin, npmInfoTestPlugin, {searchpath: pluginsDir},
done)
             .then(function() {
                 expect(registry.info).not.toHaveBeenCalled();
    -
    -            var fetchOptions = plugman.raw.fetch.mostRecentCall.args[2];
    -            expect(fetchOptions.searchpath).toBeDefined();
    +            var fetchOptions = plugman.raw.fetch.calls.mostRecent().args[2];
    +            expect(fetchOptions.searchpath[0]).toExist();
    +        })
    +        .fail(function(err) {
    +            console.error(err);
    +            expect(err).toBeUndefined();
             })
    -        .fail(errorHandler.errorCallback)
             .fin(done);
    -    });
    +    }, 30000);
     
    -    it('should not check npm info when using the noregistry flag', function(done) {
    +    it('Test 008 : should not check npm info when using the noregistry flag', function(done)
{
             mockPluginFetch(npmInfoTestPlugin, path.join(pluginsDir, npmInfoTestPlugin));
     
             spyOn(registry, 'info');
             addPlugin(npmInfoTestPlugin, npmInfoTestPlugin, {noregistry:true}, done)
             .then(function() {
                 expect(registry.info).not.toHaveBeenCalled();
     
    -            var fetchOptions = plugman.raw.fetch.mostRecentCall.args[2];
    +            var fetchOptions = plugman.raw.fetch.calls.mostRecent().args[2];
                 expect(fetchOptions.noregistry).toBeTruthy();
             })
    -        .fail(errorHandler.errorCallback)
    +        .fail(function(err) {
    +            console.error(err);
    +            expect(err).toBeUndefined();
    +        })
             .fin(done);
    -    });
    +    }, 30000);
     
    -    it('should not check npm info when fetching from a Git repository', function(done)
{
    +    it('Test 009 : should not check npm info when fetching from a Git repository', function(done)
{
             spyOn(registry, 'info');
             addPlugin(testGitPluginRepository, testGitPluginId, {}, done)
             .then(function() {
                 expect(registry.info).not.toHaveBeenCalled();
             })
    -        .fail(errorHandler.errorCallback)
    +        .fail(function(err) {
    +            console.error(err);
    +            expect(err).toBeUndefined();
    +        })
             .fin(done);
    -    });
    +    }, 30000);
     
    -    it('should select the plugin version based on npm info when fetching from npm', function(done)
{
    +    it('Test 010 : should select the plugin version based on npm info when fetching from
npm', function(done) {
             mockPluginFetch(npmInfoTestPlugin, path.join(pluginsDir, npmInfoTestPlugin));
     
    -        spyOn(registry, 'info').andCallThrough();
    +        spyOn(registry, 'info').and.callThrough();
             addPlugin(npmInfoTestPlugin, npmInfoTestPlugin, {}, done)
             .then(function() {
                 expect(registry.info).toHaveBeenCalled();
     
    -            var fetchTarget = plugman.raw.fetch.mostRecentCall.args[0];
    +            var fetchTarget = plugman.raw.fetch.calls.mostRecent().args[0];
                 expect(fetchTarget).toEqual(npmInfoTestPlugin + '@' + npmInfoTestPluginVersion);
             })
    -        .fail(errorHandler.errorCallback)
    +        .fail(function(err) {
    +            console.error(err);
    +            expect(err).toBeUndefined();
    +        })
             .fin(done);
    -    });
    +    }, 30000);
     
    -    it('should handle scoped npm packages', function(done) {
    +    it('Test 011 : should handle scoped npm packages', function(done) {
             var scopedPackage = '@testscope/' + npmInfoTestPlugin;
             mockPluginFetch(npmInfoTestPlugin, path.join(pluginsDir, npmInfoTestPlugin));
     
    -        spyOn(registry, 'info').andReturn(Q({}));
    +        spyOn(registry, 'info').and.returnValue(Q({}));
             addPlugin(scopedPackage, npmInfoTestPlugin, {}, done)
             .then(function() {
                 // Check to make sure that we are at least trying to get the correct package.
                 // This package is not published to npm, so we can't truly do end-to-end
tests
     
                 expect(registry.info).toHaveBeenCalledWith([scopedPackage]);
     
    -            var fetchTarget = plugman.raw.fetch.mostRecentCall.args[0];
    +            var fetchTarget = plugman.raw.fetch.calls.mostRecent().args[0];
                 expect(fetchTarget).toEqual(scopedPackage);
             })
    -        .fail(errorHandler.errorCallback)
    +        .fail(function(err) {
    +            console.error(err);
    --- End diff --
    
    same as 155


---
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