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 = require(path.join(project, 'package.json'));
                    expect(pkjson.name).toEqual(appName.toLowerCase());
                    expect(pkjson.valid).toEqual('true');
                }
    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, 'config.xml'));
        expect(configXml.packageName()).toEqual(appId);
        expect(configXml.version()).toEqual('1.0.0');

        // Check that config.xml does not exist inside of www
        expect(path.join(project, 'www', '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');
    }
    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 #4
0
    function checkCommonArtifacts () {
        // Check that top level dirs exist
        var dirs = ['hooks', 'platforms', 'plugins', 'www'];
        dirs.forEach(function (d) {
            expect(path.join(project, d)).toExist();
        });

        // Check that README.md exists inside of hooks
        expect(path.join(project, 'hooks', 'README.md')).toExist();

        // Check that index.html exists inside of www
        expect(path.join(project, 'www', 'index.html')).toExist();

        // Check that www files don't get copied to the top level
        expect(path.join(project, 'index.html')).not.toExist();

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

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

        // Check that config.xml was updated correctly
        var configXml = new ConfigParser(path.join(project, 'config.xml'));
        expect(configXml.packageName()).toEqual(appId);
        expect(configXml.name()).toEqual(appName);
        expect(configXml.version()).toEqual(appVersion);
    }
                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);
                }