You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by audreyso <gi...@git.apache.org> on 2017/07/21 18:16:56 UTC

[GitHub] cordova-lib pull request #581: CB-12361 : added plugin remove tests

GitHub user audreyso opened a pull request:

    https://github.com/apache/cordova-lib/pull/581

    CB-12361 : added plugin remove tests

    <!--
    Please make sure the checklist boxes are all checked before submitting the PR. The checklist
    is intended as a quick reference, for complete details please see our Contributor Guidelines:
    
    http://cordova.apache.org/contribute/contribute_guidelines.html
    
    Thanks!
    -->
    
    ### Platforms affected
    
    
    ### What does this PR do?
    
    Added plugin remove tests.
    
    ### What testing has been done on this change?
    
    
    ### Checklist
    - [X] [Reported an issue](http://cordova.apache.org/contribute/issues.html) in the JIRA database
    - [X] Commit message follows the format: "CB-3232: (android) Fix bug with resolving file paths", where CB-xxxx is the JIRA ID & "android" is the platform affected.
    - [X] Added automated test coverage as appropriate for this change.


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/audreyso/cordova-lib CB-12361-13-plugin

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/cordova-lib/pull/581.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #581
    
----
commit f2326ca2b291aef0736b8924d060fe5bd219b1cd
Author: Audrey So <au...@apache.org>
Date:   2017-07-20T23:19:07Z

    CB-12361 : added plugin remove tests

----


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


[GitHub] cordova-lib pull request #581: CB-12361 : added plugin remove tests

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/cordova-lib/pull/581


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


[GitHub] cordova-lib pull request #581: CB-12361 : added plugin remove tests

Posted by stevengill <gi...@git.apache.org>.
Github user stevengill commented on a diff in the pull request:

    https://github.com/apache/cordova-lib/pull/581#discussion_r132758854
  
    --- Diff: spec/cordova/plugin/remove.spec.js ---
    @@ -32,18 +66,123 @@ describe('cordova/plugin/remove', function () {
                     expect(e.message).toContain('No plugin specified');
                 }).done(done);
             });
    -        it('should require that a provided plugin be installed in the current project');
    +
    +        it('should require that a provided plugin be installed in the current project', function (done) {
    +            var opts = { plugins: [ undefined ] };
    +            remove(projectRoot, 'plugin', hook_mock, opts).then(function () {
    +                fail('success handler unexpectedly invoked');
    +            }).fail(function (e) {
    +                expect(e.message).toContain('is not present in the project');
    +            }).done(done);
    +        });
         });
         describe('happy path', function () {
    -        it('should fire the before_plugin_rm hook');
    -        it('should call plugman.uninstall.uninstallPlatform for each platform installed in the project and for each provided plugin');
    -        it('should trigger a prepare if plugman.uninstall.uninstallPlatform returned something falsy');
    -        it('should call plugman.uninstall.uninstallPlugin once plugin has been uninstalled for each platform');
    +        it('should fire the before_plugin_rm hook', function (done) {
    +            var opts = { important: 'options', plugins: [] };
    +            remove(projectRoot, 'cordova-plugin-splashscreen', hook_mock, opts).then(function () {
    +                expect(hook_mock.fire).toHaveBeenCalledWith('before_plugin_rm', opts);
    +            }).fail(function (e) {
    +                fail('fail handler unexpectedly invoked');
    +                console.error(e);
    +            }).done(done);
    +        });
    +
    +        it('should call plugman.uninstall.uninstallPlatform for each platform installed in the project and for each provided plugin', function (done) {
    +            remove.validatePluginId.and.returnValue('cordova-plugin-splashscreen');
    +            var opts = {important: 'options', plugins: ['cordova-plugin-splashscreen']};
    +            remove(projectRoot, 'cordova-plugin-splashscreen', hook_mock, opts).then(function () {
    +                expect(plugman.uninstall.uninstallPlatform).toHaveBeenCalled();
    +                expect(events.emit).toHaveBeenCalledWith('verbose', jasmine.stringMatching('plugman.uninstall on plugin "cordova-plugin-splashscreen" for platform "ios"'));
    +                expect(events.emit).toHaveBeenCalledWith('verbose', jasmine.stringMatching('plugman.uninstall on plugin "cordova-plugin-splashscreen" for platform "android"'));
    +            }).fail(function (e) {
    +                fail('fail handler unexpectedly invoked');
    +                console.error(e);
    +            }).done(done);
    +        });
    +
    +        it('should trigger a prepare if plugman.uninstall.uninstallPlatform returned something falsy', function (done) {
    +            remove.validatePluginId.and.returnValue('cordova-plugin-splashscreen');
    +            plugman.uninstall.uninstallPlatform.and.returnValue(Q(false));
    +            var opts = {important: 'options', plugins: ['cordova-plugin-splashscreen']};
    +            remove(projectRoot, 'cordova-plugin-splashscreen', hook_mock, opts).then(function () {
    +                expect(plugman.uninstall.uninstallPlatform).toHaveBeenCalled();
    +                expect(events.emit).toHaveBeenCalledWith('verbose', 'Calling prepare.');
    --- End diff --
    
    i'd suggest removing this expect event due to my other comment


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


[GitHub] cordova-lib pull request #581: CB-12361 : added plugin remove tests

Posted by stevengill <gi...@git.apache.org>.
Github user stevengill commented on a diff in the pull request:

    https://github.com/apache/cordova-lib/pull/581#discussion_r132758763
  
    --- Diff: src/cordova/plugin/remove.js ---
    @@ -68,6 +68,7 @@ function remove (projectRoot, targets, hooksRunner, opts) {
                                     // If platform does not returned anything we'll need
                                     // to trigger a prepare after all plugins installed
                                     // TODO: if didPrepare is falsy, what does that imply? WHY are we doing this?
    +                                events.emit('verbose', 'Calling prepare.');
    --- End diff --
    
    I think you might want to remove this event. Since Prepare will only be called if `didPrepare` is falsy. So you could get the output `calling prepare` when you actually don't call prepare


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