<commit_before>/*!
 * stringify-changelog <https://github.com/jonschlinkert/stringify-changelog>
 *
 * Copyright (c) 2015, <NAME>.
 * Licensed under the MIT License.
 */

'use strict';

/* deps:mocha */
var assert = require('assert');
var should = require('should');
var moment = require('moment');
var changlog = require('./');

describe('changlog', function () {
  it('should generate a changelog from a yaml file:', function () {
    changlog('fixtures/a.yml').should.equal([
      '**DATE**       **VERSION**   **CHANGES**                  ',
      '* 2016-12-26   v0.1.0        Got stuck in another chimney.',
    ].join('\n'));
  });

  it('should generate a changelog from an object:', function () {
    var data = { 'v0.1.0': { date: '2016-12-26', changes: [ 'Got stuck in another chimney.' ] } };
    changlog(data).should.equal([
      '**DATE**       **VERSION**   **CHANGES**                  ',
      '* 2016-12-26   v0.1.0        Got stuck in another chimney.',
    ].join('\n'));
  });

  it('should generate a changelog from an array:', function () {
    var data = [
      {date: '2016-12-26', version: 'v0.1.0', changes: [ 'Got stuck in another chimney.' ]
    }];

    changlog(data).should.equal([
      '**DATE**       **VERSION**   **CHANGES**                  ',
      '* 2016-12-26   v0.1.0        Got stuck in another chimney.',
    ].join('\n'));
  });

  it('should allow a custom date function:', function () {
    var data = [
      {date: '2016-12-26', version: 'v0.1.0', changes: [ 'Got stuck in another chimney.' ]
    }];

    var opts = {};
    opts.dateFn = function (date) {
    // console.log(arguments)
      return ' * ' + moment(date).format('YYYY-MM-DD');
    };

    changlog(data, opts).should.equal([
      '**DATE**       **VERSION**   **CHANGES**                  ',
      '* 2016-12-26   v0.1.0        Got stuck in another chimney.',
    ].join('\n'));
  });

  it('should throw an error:', function () {
    (function () {
      changlog();
    }).should.throw('helper-changelog cannot find data or a file to read.');
  });
});<commit_msg>clean up<commit_after>/*!
 * stringify-changelog <https://github.com/jonschlinkert/stringify-changelog>
 *
 * Copyright (c) 2015, <NAME>.
 * Licensed under the MIT License.
 */

'use strict';

/* deps:mocha */
var assert = require('assert');
var should = require('should');
var moment = require('moment');
var changelog = require('./');

describe('changelog', function () {
  it('should generate a changelog from a yaml file:', function () {
    changelog('fixtures/a.yml').should.equal([
      '**DATE**       **VERSION**   **CHANGES**                  ',
      '* 2016-12-26   v0.1.0        Got stuck in another chimney.',
    ].join('\n'));
  });

  it('should generate a changelog from an object:', function () {
    var data = { 'v0.1.0': { date: '2016-12-26', changes: [ 'Got stuck in another chimney.' ] } };
    changelog(data).should.equal([
      '**DATE**       **VERSION**   **CHANGES**                  ',
      '* 2016-12-26   v0.1.0        Got stuck in another chimney.',
    ].join('\n'));
  });

  it('should generate a changelog from an array:', function () {
    var data = [
      {date: '2016-12-26', version: 'v0.1.0', changes: [ 'Got stuck in another chimney.' ]
    }];

    changelog(data).should.equal([
      '**DATE**       **VERSION**   **CHANGES**                  ',
      '* 2016-12-26   v0.1.0        Got stuck in another chimney.',
    ].join('\n'));
  });

  it('should allow a custom date function:', function () {
    var data = [
      {date: '2016-12-26', version: 'v0.1.0', changes: [ 'Got stuck in another chimney.' ]
    }];

    var opts = {};
    opts.dateFn = function (date) {
      return ' * ' + moment(date).format('YYYY-MM-DD');
    };

    changelog(data, opts).should.equal([
      '**DATE**       **VERSION**   **CHANGES**                  ',
      '* 2016-12-26   v0.1.0        Got stuck in another chimney.',
    ].join('\n'));
  });

  it('should throw an error:', function () {
    (function () {
      changelog();
    }).should.throw('helper-changelog cannot find data or a file to read.');
  });
});
{'fraction_non_alphanumeric': 0.19561022672455378, 'fraction_numerical': 0.03907380607814761, 'mean_word_length': 2.2991249005568815, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 2, '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': '2151994', 'n_tokens_mistral': 1465, 'n_tokens_neox': 1357, 'n_words': 340}