<commit_before>let TimerState = require('../../src/state/timer-state')
let TestTimer = require('./test-timer')
let assert = require('assert')

describe('timer-state', () => {
  let timerState
  let events

  let assertEvent = (eventName) => {
    var event = events.find(x => x.event == eventName);
    assert(event, eventName + ' event not found')
    return event
  }

  beforeEach(() => {
    events = []
    timerState = new TimerState({ Timer: TestTimer })
    timerState.setCallback((event, data) => {
      events.push({event, data})
    })
  })

  afterEach(() => timerState.pause())

  describe('initialize', () => {
    beforeEach(() => timerState.initialize())

    it('should publish a timerChange event', () => {
      var event = assertEvent('timerChange')
      assert.equal(event.data, 600)
    })

    it('should publish a rotated event', () => {
      var event = assertEvent('rotated')
      assert.deepEqual(event.data, { current: null, next: null })
    })
<commit_msg>Remove afterEach which is no longer needed<commit_after>let TimerState = require('../../src/state/timer-state')
let TestTimer = require('./test-timer')
let assert = require('assert')

describe('timer-state', () => {
  let timerState
  let events

  let assertEvent = (eventName) => {
    var event = events.find(x => x.event == eventName);
    assert(event, eventName + ' event not found')
    return event
  }

  beforeEach(() => {
    events = []
    timerState = new TimerState({ Timer: TestTimer })
    timerState.setCallback((event, data) => {
      events.push({event, data})
    })
  })

  describe('initialize', () => {
    beforeEach(() => timerState.initialize())

    it('should publish a timerChange event', () => {
      var event = assertEvent('timerChange')
      assert.equal(event.data, 600)
    })

    it('should publish a rotated event', () => {
      var event = assertEvent('rotated')
      assert.deepEqual(event.data, { current: null, next: null })
    })

{'fraction_non_alphanumeric': 0.16802030456852793, 'fraction_numerical': 0.003045685279187817, 'mean_word_length': 3.2115384615384617, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 22, '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': '5808760', 'n_tokens_mistral': 600, 'n_tokens_neox': 572, 'n_words': 140}