<commit_before>'use strict';

var path = require('path');
var helpers = require('yeoman-generator').test;

describe('the sandbox generator', function () {
  beforeEach(function (done) {
    helpers.testDirectory(path.join(__dirname, 'temp'), function (err) {
      if (err) {
        return done(err);
      }

      this.app = helpers.createGenerator('sandbox:app', [
        '../../app'
      ]);

      done();
    }.bind(this));
  });

  it('creates expected project files with no extra features', function (done) {
    helpers.mockPrompt(this.app, {
      appName: 'myapp',
      basicFeatures : [],
      angularFeatures: [],
      scssFeatures : []
    });

    var expectedFiles = [
      // Add files you expect to exist here
      '.jshintrc',
      '.jscs.json',
      '.editorconfig',
      '.gitignore',
      '.gitattributes',
      'package.json',
      'bower.json',
      '.bowerrc',
      'gulpfile.js',
      'README.md',
      'public/index.html',
      'public/scripts/app.js',
      'public/styles/main.css'
    ];

    var expectedContent = [
      ['public/index.html', /<title>myapp<\/title>/],
      ['package.json', /"name": "myapp"/],
      ['bower.json', /"name": "myapp"/],
      ['README.md', /myapp/]
    ];

    this.app.options['skip-install'] = true;
    this.timeout(15000);
    this.app.run({}, function () {
      helpers.assertFile(expectedFiles);
      helpers.assertFileContent(expectedContent);
      done();
    });
  });

  it('creates expected files when all features enabled', function (done) {
    helpers.mockPrompt(this.app, {
      appName: 'myapp',
      basicFeatures : ['includeAngular', 'includeLodash', 'includeScss'],
      angularFeatures: ['includeAngularResource', 'includeAngularCookies', 'includeAngularSanitize', 'includeAngularRoute', 'includeAngularUiRouter'],
      scssFeatures : [,'includeInuitCss', 'includeNormalizeScss', 'includeCsswizardryGrids']
    });

    var expectedFiles = [
      // Add files you expect to exist here
      'public/index.html',
      'bower.json',
      '.jshintrc',
      '.gitignore',
      'public/scripts/app.js',
      'public/styles/scss/main.scss'
    ];

    var expectedContent = [
      ['public/index.html', /ng-app="myapp"/],
      ['public/index.html', /<script src="lib\/angular\/angular.js"><\/script>/],
      ['public/index.html', /<script src="lib\/angular\/angular.js"><\/script>/],
      ['public/index.html', /<script src="lib\/angular-resource\/angular-resource.js"><\/script>/],
      ['public/index.html', /<script src="lib\/angular-cookies\/angular-cookies.js"><\/script>/],
      ['public/index.html', /<script src="lib\/angular-sanitize\/angular-sanitize.js"><\/script>/],
      ['public/index.html', /<script src="lib\/angular-route\/angular-route.js"><\/script>/],
      ['public/index.html', /<script src="lib\/angular-ui-router\/release\/angular-ui-router.js"><\/script>/],
      ['public/index.html', /<script src="lib\/lodash\/dist\/lodash.compat.js"><\/script>/],
      ['public/index.html', /<link rel="stylesheet" href="styles\/css\/main.css">/],<commit_msg>fix index.html test<commit_after>'use strict';

var path = require('path');
var helpers = require('yeoman-generator').test;

describe('the sandbox generator', function () {
  beforeEach(function (done) {
    helpers.testDirectory(path.join(__dirname, 'temp'), function (err) {
      if (err) {
        return done(err);
      }

      this.app = helpers.createGenerator('sandbox:app', [
        '../../app'
      ]);

      done();
    }.bind(this));
  });

  it('creates expected project files with no extra features', function (done) {
    helpers.mockPrompt(this.app, {
      appName: 'myapp',
      basicFeatures : [],
      angularFeatures: [],
      scssFeatures : []
    });

    var expectedFiles = [
      // Add files you expect to exist here
      '.jshintrc',
      '.jscs.json',
      '.editorconfig',
      '.gitignore',
      '.gitattributes',
      'package.json',
      'bower.json',
      '.bowerrc',
      'gulpfile.js',
      'README.md',
      'public/index.html',
      'public/scripts/app.js',
      'public/styles/main.css'
    ];

    var expectedContent = [
      ['public/index.html', /<title>myapp<\/title>/],
      ['package.json', /"name": "myapp"/],
      ['bower.json', /"name": "myapp"/],
      ['README.md', /myapp/]
    ];

    this.app.options['skip-install'] = true;
    this.timeout(15000);
    this.app.run({}, function () {
      helpers.assertFile(expectedFiles);
      helpers.assertFileContent(expectedContent);
      done();
    });
  });

  it('creates expected files when all features enabled', function (done) {
    helpers.mockPrompt(this.app, {
      appName: 'myapp',
      basicFeatures : ['includeAngular', 'includeLodash', 'includeScss'],
      angularFeatures: ['includeAngularResource', 'includeAngularCookies', 'includeAngularSanitize', 'includeAngularRoute', 'includeAngularUiRouter'],
      scssFeatures : [,'includeInuitCss', 'includeNormalizeScss', 'includeCsswizardryGrids']
    });

    var expectedFiles = [
      // Add files you expect to exist here
      'public/index.html',
      'bower.json',
      '.jshintrc',
      '.gitignore',
      'public/scripts/app.js',
      'public/styles/scss/main.scss'
    ];

    var expectedContent = [
      ['public/index.html', /ng-app="myappApp"/],
      ['public/index.html', /<script src="lib\/angular\/angular.js"><\/script>/],
      ['public/index.html', /<script src="lib\/angular\/angular.js"><\/script>/],
      ['public/index.html', /<script src="lib\/angular-resource\/angular-resource.js"><\/script>/],
      ['public/index.html', /<script src="lib\/angular-cookies\/angular-cookies.js"><\/script>/],
      ['public/index.html', /<script src="lib\/angular-sanitize\/angular-sanitize.js"><\/script>/],
      ['public/index.html', /<script src="lib\/angular-route\/angular-route.js"><\/script>/],
      ['public/index.html', /<script src="lib\/angular-ui-router\/release\/angular-ui-router.js"><\/script>/],
      ['public/index.html', /<script src="lib\/lodash\/dist\/lodash.compat.js"><\/script>/],
      ['public/index.html', /<link rel="stylesheet" href="styles\/css\/main.css">/],
{'fraction_non_alphanumeric': 0.1985781224753595, 'fraction_numerical': 0.0016157699143641946, 'mean_word_length': 2.835192069392813, 'pattern_counts': {'":': 4, '<': 41, '<?xml version=': 0, '>': 41, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6776503', 'n_tokens_mistral': 2002, 'n_tokens_neox': 1967, 'n_words': 317}