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 2016/11/18 17:49:08 UTC

[GitHub] cordova-lib pull request #499: Cb 11960

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

    https://github.com/apache/cordova-lib/pull/499#discussion_r88704297
  
    --- Diff: cordova-lib/spec-cordova/pkgJson-restore.spec.js ---
    @@ -414,6 +414,80 @@ describe('tests platform/spec restore with --save', function () {
             }).fin(done);
         // Cordova prepare needs extra wait time to complete.
         },30000);
    +
    +    /** Test#018
    +    *   When plugin is added with url and fetch and restored with fetch, 
    +    *   pkg.json and config.xml would add it to their files properly.
    +    *   When prepare is run with fetch, plugin should be installed.
    +    */
    +    it('Test#018 : test to make sure that plugin url is added and restored properly', function(done) {
    +        var cwd = process.cwd();
    +        var pkgJsonPath = path.join(cwd,'package.json');
    +        var pkgJson;
    +        var pluginsFolderPath = path.join(cwd,'plugins');
    +        var configXmlPath = path.join(cwd, 'config.xml');
    +        var configPlugins;
    +        var configPlugin;
    +
    +        emptyPlatformList().then(function() {
    +            // Add plugin with save and fetch.
    +            return cordova.raw.plugin('add', ['https://github.com/apache/cordova-plugin-splashscreen'], {'save':true, 'fetch':true});
    +        }).then(function() {
    +            // Plugin id and spec were added to config.xml successfully.
    +            var cfg = new ConfigParser(configXmlPath);
    +            configPlugins = cfg.getPluginIdList();
    +            configPlugin = cfg.getPlugin(configPlugins);
    +            expect(configPlugin.spec).toEqual('https://github.com/apache/cordova-plugin-splashscreen');
    +            expect(configPlugin.name).toEqual('cordova-plugin-splashscreen');
    +            // Plugin was added to pkg.json successfully in plugin list and dependencies.
    +            delete require.cache[require.resolve(pkgJsonPath)];
    +            pkgJson = require(pkgJsonPath);
    +            expect(pkgJson.dependencies).toEqual({ 'cordova-plugin-splashscreen': 'git+https://github.com/apache/cordova-plugin-splashscreen.git' });
    +            expect(pkgJson.cordova.plugins['cordova-plugin-splashscreen']).toBeDefined();
    +            // Plugin was added to installed plugin list successfully.
    +            expect(path.join(pluginsFolderPath, 'cordova-plugin-splashscreen')).toExist();
    +        }).then(function() {
    +            // Remove plugin without --save.
    +            return cordova.raw.plugin('rm', 'cordova-plugin-splashscreen', {'fetch':true});
    +        }).then(function() {
    +            // Plugin id and spec are still in config.xml.
    +            var cfg2 = new ConfigParser(configXmlPath);
    +            configPlugins = cfg2.getPluginIdList();
    +            configPlugin = cfg2.getPlugin(configPlugins);
    +            expect(configPlugin.spec).toEqual('https://github.com/apache/cordova-plugin-splashscreen');
    +            expect(configPlugin.name).toEqual('cordova-plugin-splashscreen');
    +            // // Plugin still in pkg.json plugin list and dependencies.
    --- End diff --
    
    I will fix this typo


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