<commit_before>/* global describe, it, before, after */

const assert = require('assert')
const sinon = require('sinon')
let dates

require('../../braveUnit')

describe('update date handling', function () {
  const exampleDate = 1510708981887 // Tuesday November 14th 2017, 6:23:01 PM
  const exampleDate2 = 1512304291746 // Monday December 04th 2017, 9:18:11 AM
  let fakeClock
  before(function () {
    fakeClock = sinon.useFakeTimers(exampleDate)
    dates = require('../../../../app/dates')
  })
  after(function () {
    fakeClock.restore()
  })

  describe('todayYMD', function () {
    it('returns YYYY-MM-DD of today', function () {
      assert.equal(dates.todayYMD(), '2017-11-14', 'today')
    })
  })

  describe('todayWOY', function () {
    it('returns the ISO week number for today', function () {
      assert.equal(dates.todayWOY(), 314, 'ISO week number')
    })
  })

  describe('todayMonth', function () {
    it('returns the month of today as a number', function () {
      assert.equal(dates.todayMonth(), 11, 'Month of today')
    })
  })

  describe('lastMonday', function () {
    it('returns YYYY-MM-DD of closest Monday in the past to current date', function () {
      const d = new Date(exampleDate)
      assert.equal(dates.lastMonday(d), '2017-11-13', 'previous Monday')
    })
    it('returns YYYY-MM-DD of today if today is monday', function () {
      const d = new Date(exampleDate2)
      assert.equal(dates.lastMonday(d), '2017-12-04', 'today is Monday')
    })
  })
})
<commit_msg>Account for time zone discrepancy on Travis<commit_after>/* global describe, it, before, after */

const assert = require('assert')
const sinon = require('sinon')
let dates

require('../../braveUnit')

describe('update date handling', function () {
  const exampleDate = 1510687381887 // Tuesday November 14th 2017, 12:23:01 PM
  const exampleDate2 = 1512304291746 // Monday December 04th 2017, 9:18:11 AM
  let fakeClock
  before(function () {
    fakeClock = sinon.useFakeTimers(exampleDate)
    dates = require('../../../../app/dates')
  })
  after(function () {
    fakeClock.restore()
  })

  describe('todayYMD', function () {
    it('returns YYYY-MM-DD of today', function () {
      assert.equal(dates.todayYMD(), '2017-11-14', 'today')
    })
  })

  describe('todayWOY', function () {
    it('returns the ISO week number for today', function () {
      assert.equal(dates.todayWOY(), 314, 'ISO week number')
    })
  })

  describe('todayMonth', function () {
    it('returns the month of today as a number', function () {
      assert.equal(dates.todayMonth(), 11, 'Month of today')
    })
  })

  describe('lastMonday', function () {
    it('returns YYYY-MM-DD of closest Monday in the past to current date', function () {
      const d = new Date(exampleDate)
      assert.equal(dates.lastMonday(d), '2017-11-13', 'previous Monday')
    })
    it('returns YYYY-MM-DD of today if today is monday', function () {
      const d = new Date(exampleDate2)
      assert.equal(dates.lastMonday(d), '2017-12-04', 'today is Monday')
    })
  })
})

{'fraction_non_alphanumeric': 0.15825464018235103, 'fraction_numerical': 0.05177466623249756, 'mean_word_length': 3.2965034965034965, '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': '4497393', 'n_tokens_mistral': 1099, 'n_tokens_neox': 948, 'n_words': 260}