Example #1
0
    function checkConfigXml() {
        // Check if top level dirs exist.
        var dirs = ['hooks', 'platforms', 'plugins', 'www'];
        dirs.forEach(function(d) {
            expect(path.join(project, d)).toExist();
        });
        expect(path.join(project, 'hooks', 'README.md')).toExist();
        
        //index.js and template subdir folder should not exist (inner files should be copied to the project folder)
        expect(path.join(project, 'index.js')).not.toExist();
        expect(path.join(project, 'template')).not.toExist();

        // Check if www files exist.
        expect(path.join(project, 'www', 'index.html')).toExist();
        var configXml = new ConfigParser(path.join(project, 'www', 'config.xml'));
        expect(configXml.packageName()).toEqual(appId);
        expect(configXml.version()).toEqual('1.0.0');

        // Check that config.xml does not exist outside of www
        expect(path.join(project, 'config.xml')).not.toExist();

        // Check that we got no package.json
        expect(path.join(project, 'package.json')).not.toExist();

        // Check that we got the right config.xml from the template and not stock
        expect(configXml.description()).toEqual('this is the correct config.xml');
    }
Example #2
0
    function checkSubDir() {
        // Check if top level dirs exist.
        var dirs = ['hooks', 'platforms', 'plugins', 'www'];
        dirs.forEach(function(d) {
            expect(path.join(project, d)).toExist();
        });
        expect(path.join(project, 'hooks', 'README.md')).toExist();
        
        //index.js and template subdir folder should not exist (inner files should be copied to the project folder)
        expect(path.join(project, 'index.js')).not.toExist();
        expect(path.join(project, 'template')).not.toExist();

        // Check if config files exist.
        expect(path.join(project, 'www', 'index.html')).toExist();

        // Check that config.xml was updated.
        var configXml = new ConfigParser(path.join(project, 'config.xml'));
        expect(configXml.packageName()).toEqual(appId);
        expect(configXml.version()).toEqual('1.0.0');


        // Check that we got package.json (the correct one)
        var pkjson = require(path.join(project, 'package.json'));
        expect(pkjson.name).toEqual(appName.toLowerCase());
        expect(pkjson.valid).toEqual('true');

        // Check that we got the right config.xml
        expect(configXml.description()).toEqual('this is the correct config.xml');
    }
Example #3
0
            function checkSymSubDir () {
                // Check if top level dirs exist.
                var dirs = ['hooks', 'platforms', 'plugins', 'www'];
                dirs.forEach(function (d) {
                    expect(path.join(project, d)).toExist();
                });
                expect(path.join(project, 'hooks', 'README.md')).toExist();

                // index.js and template subdir folder should not exist (inner files should be copied to the project folder)
                expect(path.join(project, 'index.js')).not.toExist();
                expect(path.join(project, 'template')).not.toExist();

                // Check if www files exist.
                expect(path.join(project, 'www', 'index.html')).toExist();

                // Check that www, and config.xml is really a symlink
                expect(fs.lstatSync(path.join(project, 'www')).isSymbolicLink()).toBe(true);
                expect(fs.lstatSync(path.join(project, 'config.xml')).isSymbolicLink()).toBe(true);

                // Check that config.xml was not updated. (symlinked config does not get updated!)
                var configXml = new ConfigParser(path.join(project, 'config.xml'));
                expect(configXml.packageName()).toEqual('io.cordova.hellocordova');
                expect(configXml.version()).toEqual('0.0.1');

                // Check that we got the right config.xml
                expect(configXml.description()).toEqual('this is the correct config.xml');

                // Check that we got package.json (the correct one) and it was changed
                var pkjson = requireFresh(path.join(project, 'package.json'));
                // Pkjson.name should equal config's id.
                expect(pkjson.name).toEqual(appId.toLowerCase());
                expect(pkjson.valid).toEqual('true');
            }
                function checkSymWWW() {
                    // Check if top level dirs exist.
                    var dirs = ['hooks', 'platforms', 'plugins', 'www'];
                    dirs.forEach(function(d) {
                        expect(path.join(project, d)).toExist();
                    });
                    expect(path.join(project, 'hooks', 'README.md')).toExist();

                    // Check if www files exist.
                    expect(path.join(project, 'www', 'index.html')).toExist();
                    
                    // Check www/config exists 
                    expect(path.join(project, 'www', 'config.xml')).toExist();
                    // Check www/config.xml was not updated. 
                    var configXml = new ConfigParser(path.join(project, 'www', 'config.xml'));
                    expect(configXml.packageName()).toEqual('io.cordova.hellocordova');
                    expect(configXml.version()).toEqual('0.0.1');
                    expect(configXml.description()).toEqual('this is the correct config.xml');

                    // Check that config.xml was copied to project/config.xml
                    expect(path.join(project, 'config.xml')).toExist();
                    configXml = new ConfigParser(path.join(project, 'config.xml'));
                    expect(configXml.description()).toEqual('this is the correct config.xml');
                    // Check project/config.xml was updated. 
                    expect(configXml.packageName()).toEqual(appId);
                    expect(configXml.version()).toEqual('1.0.0');

                    // Check that we got no package.json
                    expect(path.join(project, 'package.json')).not.toExist();

                     // Check that www is really a symlink, 
                    // and project/config.xml , hooks and merges are not
                    expect(fs.lstatSync(path.join(project, 'www')).isSymbolicLink()).toBe(true);
                    expect(fs.lstatSync(path.join(project, 'hooks')).isSymbolicLink()).not.toBe(true);
                    expect(fs.lstatSync(path.join(project, 'config.xml')).isSymbolicLink()).not.toBe(true);
                }
 .then(function(){
     // Check that we got the right config.xml
     var configXml = new ConfigParser(path.join(project, 'config.xml'));
     expect(configXml.description()).toEqual('this is the very correct config.xml');
 })