<commit_before>'use strict';
/* jshint expr:true */

var chai = require('chai');
var sinonChai = require('sinon-chai');
chai.should();
chai.use(sinonChai);

var templateTools = require('../template-tools');
var mockModel = require('./mock-model');

describe('gulp-angular karma.conf template', function () {
  var karmaConf, model;

  before(function() {
    return templateTools.load('_karma.conf.js')
      .then(function(templateModule) {
        karmaConf = templateModule;
      });
  });

  beforeEach(function() {
    model = mockModel();
  });

  it('should add files in list files for each js preprocessors', function() {
    model.props.jsPreprocessor.key = 'none';
    var result = karmaConf(model);
    result.should.match(/conf\.paths\.src, '[^\s]*\.js'/);

    model.props.jsPreprocessor.key = 'coffee';
    result = karmaConf(model);
    result.should.match(/conf\.paths\.tmp, '\/serve[^\s]*\.js'/);

    model.props.jsPreprocessor.key = 'babel';
    result = karmaConf(model);
    result.should.match(/conf\.paths\.tmp, '\/serve\/app\/index\.js/);
  });

  it('should add and configure angular filesort if needed', function() {
    model.props.jsPreprocessor.key = 'babel';
    var result = karmaConf(model);
    result.should.match(/frameworks: \['jasmine'\]/);
    result.should.not.match(/'karma-angular-filesort'/);

    model.props.jsPreprocessor.key = 'none';
    result = karmaConf(model);
    result.should.match(/frameworks: \['jasmine', 'angular-filesort'\]/);
    result.should.match(/whitelist: \[[^\s]*conf\.paths\.src/);
    result.should.match(/'karma-angular-filesort'/);

    model.props.jsPreprocessor.key = 'coffee';
    result = karmaConf(model);
    result.should.match(/frameworks: \['jasmine', 'angular-filesort'\]/);
    result.should.match(/whitelist: \[[^\s]*conf\.paths\.tmp/);
    result.should.match(/'karma-angular-filesort'/);
  });

  it('should replace phantom with chrome for traceur', function() {
    model.props.jsPreprocessor.key = 'none';
    var result = karmaConf(model);
    result.should.match(/browsers : \['PhantomJS'\]/);
    result.should.match(/'karma-phantomjs-launcher'/);<commit_msg>Fix test for template karma-conf<commit_after>'use strict';
/* jshint expr:true */

var chai = require('chai');
var sinonChai = require('sinon-chai');
chai.should();
chai.use(sinonChai);

var templateTools = require('../template-tools');
var mockModel = require('./mock-model');

describe('gulp-angular karma.conf template', function () {
  var karmaConf, model;

  before(function() {
    return templateTools.load('_karma.conf.js')
      .then(function(templateModule) {
        karmaConf = templateModule;
      });
  });

  beforeEach(function() {
    model = mockModel();
  });

  it('should add files in list files for each js preprocessors', function() {
    model.props.jsPreprocessor.key = 'none';
    var result = karmaConf(model);
    result.should.match(/conf\.paths\.src, '[^\s]*\.module\.js'/);
    result.should.match(/conf\.paths\.src, '[^\s]*\.js'/);

    model.props.jsPreprocessor.key = 'coffee';
    result = karmaConf(model);
    result.should.match(/conf\.paths\.tmp, '\/serve[^\s]*\.module\.js'/);
    result.should.match(/conf\.paths\.tmp, '\/serve[^\s]*\.js'/);

    model.props.jsPreprocessor.key = 'babel';
    result = karmaConf(model);
    result.should.match(/conf\.paths\.tmp, '\/serve\/app\/index\.module\.js/);
  });

  it('should add and configure angular filesort if needed', function() {
    model.props.jsPreprocessor.key = 'babel';
    var result = karmaConf(model);
    result.should.match(/frameworks: \['jasmine'\]/);
    result.should.not.match(/'karma-angular-filesort'/);

    model.props.jsPreprocessor.key = 'none';
    result = karmaConf(model);
    result.should.match(/frameworks: \['jasmine', 'angular-filesort'\]/);
    result.should.match(/whitelist: \[[^\s]*conf\.paths\.src/);
    result.should.match(/'karma-angular-filesort'/);

    model.props.jsPreprocessor.key = 'coffee';
    result = karmaConf(model);
    result.should.match(/frameworks: \['jasmine', 'angular-filesort'\]/);
    result.should.match(/whitelist: \[[^\s]*conf\.paths\.tmp/);
    result.should.match(/'karma-angular-filesort'/);
  });

  it('should replace phantom with chrome for traceur', function() {
    model.props.jsPreprocessor.key = 'none';
    var result = karmaConf(model);
    result.should.match(/browsers : \['PhantomJS'\]/);
    result.should.match(/'karma-phantomjs-launcher'/);
{'fraction_non_alphanumeric': 0.19628469113697403, 'fraction_numerical': 0.0, 'mean_word_length': 3.5232793522267207, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '7536200', 'n_tokens_mistral': 1556, 'n_tokens_neox': 1464, 'n_words': 241}