<commit_before>var Message = require('../lib/message');

describe('Message <Formats>', function () {

  beforeEach(function () {
    this.clock = sinon.useFakeTimers(
      new Date(2014, 7, 20).getTime()
    );
  });

  afterEach(function () {
    this.clock.restore();
  });

  describe('config', function () {
    it('should accept options to extend original config', function () {

      var message = new Message({
        foo: 'bar'
      });

      message.config.should.be.an.instanceOf(Object);
      message.config.should.eql({
        dateFormat: 'Do MMM YY',
        foo: 'bar'
      });

    });
  });

  describe('dataset emails', function () {
    var dataSet = {
      'name': 'deposit_foreign_marriage_journey',
      'last-updated': '2014-01-16T16:33:04.455000+00:00',
      'max-age-expected': 90000,
      'seconds-out-of-date': 18484718
    };

    it('Generate a message about how out of date a data-set is', function () {

      var message = new Message();

      var reminder = message.dataSetReminder(dataSet);

      reminder.should.contain(
        'The data set deposit_foreign_marriage_journey was last updated on 16th Jan 14'
      );
      reminder.should.contain(
          '215 days out of date.'
      );
      reminder.should.contain(
          'Please upload the data at your earliest convenience.'
      );

    });

    it('Returns a different date format when passed in', function () {

      var message = new Message();

      message.dataSetReminder(dataSet, {
        dateFormat: 'MMMM Do YYYY, h:mm:ss a'
      }).should.contain(
        'January 16th 2014, 4:33:04 pm'
      );
<commit_msg>Fixed faketimers. Hate dates<commit_after>var Message = require('../lib/message'),
  moment = require('moment');

describe('Message <Formats>', function () {

  beforeEach(function () {
    this.clock = sinon.useFakeTimers(moment('2014-07-20T00:00:00Z').utc().unix() * 1000);
  });

  afterEach(function () {
    this.clock.restore();
  });

  describe('config', function () {
    it('should accept options to extend original config', function () {

      var message = new Message({
        foo: 'bar'
      });

      message.config.should.be.an.instanceOf(Object);
      message.config.should.eql({
        dateFormat: 'Do MMM YY',
        foo: 'bar'
      });

    });
  });

  describe('dataset emails', function () {
    var dataSet = {
      'name': 'deposit_foreign_marriage_journey',
      'last-updated': '2014-01-16T16:33:04.455000+00:00',
      'max-age-expected': 90000,
      'seconds-out-of-date': 18484718
    };

    it('Generate a message about how out of date a data-set is', function () {

      var message = new Message();

      var reminder = message.dataSetReminder(dataSet);

      reminder.should.contain(
        'The data set deposit_foreign_marriage_journey was last updated on 16th Jan 14'
      );
      reminder.should.contain(
          '184 days out of date.'
      );
      reminder.should.contain(
          'Please upload the data at your earliest convenience.'
      );

    });

    it('Returns a different date format when passed in', function () {

      var message = new Message();

      message.dataSetReminder(dataSet, {
        dateFormat: 'MMMM Do YYYY, h:mm:ss a'
      }).should.contain(
        'January 16th 2014, 4:33:04 pm'
      );

{'fraction_non_alphanumeric': 0.13989169675090252, 'fraction_numerical': 0.04061371841155235, 'mean_word_length': 2.529723991507431, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '3787018', 'n_tokens_mistral': 1141, 'n_tokens_neox': 1024, 'n_words': 250}