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

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/584#discussion_r136487019
  
    --- Diff: spec/cordova/plugin/save.spec.js ---
    @@ -54,15 +61,145 @@ describe('cordova/plugin/save', function () {
             });
         });
         describe('happy path', function () {
    -        it('should remove all plugins from config.xml and re-add new ones 
based on those retrieved from fetch.json');
    -        it('should only add top-level plugins to config.xml');
    -        it('should write individual plugin specs to config.xml');
    -        it('should write individual plugin variables to config.xml');
    +        it('should remove all plugins from config.xml and re-add new ones 
based on those retrieved from fetch.json', function (done) {
    +            save(projectRoot).then(function () {
    +                
expect(cfg_parser_mock.prototype.removePlugin).toHaveBeenCalledWith('VRPlugin');
    +                
expect(cfg_parser_mock.prototype.removePlugin).toHaveBeenCalledWith('MastodonSocialPlugin');
    +            }).fail(function (e) {
    +                expect(e).toBeUndefined();
    +                fail('did not expect fail handler to be invoked');
    +            }).done(done);
    +        });
    +
    +        it('should only add top-level plugins to config.xml', function 
(done) {
    +            var fake_fetch_json =
    +                {'VRPlugin': {'source': {
    +                    'type': 'registry',
    +                    'id': 'id'
    +                },
    +                'is_top_level': true
    +                },
    +                'MastodonSocialPlugin': { 'source': {
    +                    'type': 'registry',
    +                    'id': 'id'
    +                },
    +                'is_top_level': false }};
    +
    +            
fs.readFileSync.and.returnValue(JSON.stringify(fake_fetch_json));
    +            save(projectRoot).then(function () {
    +                
expect(cfg_parser_mock.prototype.addPlugin).toHaveBeenCalledWith(Object({ name: 
'VRPlugin' }), [ ]);
    --- End diff --
    
    Maybe add another expect to show that the non top level plugin didn't get 
installed. Something like 
    ```
    expect(cfg_parser_mock.prototype.addPlugin).toHaveBeenCalledWith(Object({ 
name: 'MastodonSocialPlugin' }), [ ]);```


> 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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to