<commit_before>import React     from 'react';
import ReactDOM  from 'react-dom';
import expect    from 'expect';
import $         from 'jQuery';
import TestUtils from 'react-addons-test-utils';

import Countdown from 'Countdown';

describe('Countdown', () => {
  it('should exist', () => {
    expect(Countdown).toExist();
  });

  describe('handleSetCountdown', () => {
    it('should set state to running and count down', (done) => {
      let countdown = TestUtils.renderIntoDocument(<Countdown />);

      countdown.handleSetCountdown(10);

      expect(countdown.state.count).toBe(10);
      expect(countdown.state.countdownStatus).toBe('running');

      setTimeout(() => {
        expect(countdown.state.count).toBe(9);
        done();
      }, 1001);   // Confident, much?
    });

    it('should not let count to go below 0', (done) => {
      let countdown = TestUtils.renderIntoDocument(<Countdown />);

      countdown.handleSetCountdown(1);

      setTimeout(() => {
        expect(countdown.state.count).toBe(0);
        done();
      }, 2001);
    });
  });
});<commit_msg>Test Countdown status changes<commit_after>import React     from 'react';
import ReactDOM  from 'react-dom';
import expect    from 'expect';
import $         from 'jQuery';
import TestUtils from 'react-addons-test-utils';

import Countdown from 'Countdown';

describe('Countdown', () => {
  it('should exist', () => {
    expect(Countdown).toExist();
  });

  describe('handleSetCountdown', () => {
    it('should set state to running and count down', (done) => {
      let countdown = TestUtils.renderIntoDocument(<Countdown />);

      countdown.handleSetCountdown(10);

      expect(countdown.state.count).toBe(10);
      expect(countdown.state.countdownStatus).toBe('running');

      setTimeout(() => {
        expect(countdown.state.count).toBe(9);
        done();
      }, 1001);   // Confident, much?
    });

    it('should not let count to go below 0', (done) => {
      let countdown = TestUtils.renderIntoDocument(<Countdown />);

      countdown.handleSetCountdown(1);

      setTimeout(() => {
        expect(countdown.state.count).toBe(0);
        done();
      }, 2001);
    });

    it('should pause countdown on paused status', (done) => {
      let countdown = TestUtils.renderIntoDocument(<Countdown />);

      countdown.handleSetCountdown(3);
      countdown.handleStatusChange('paused')

      setTimeout(() => {
        expect(countdown.state.count).toBe(3);
        expect(countdown.state.countdownStatus).toBe('paused');
        done();
      }, 1001);
    });

    it('should stop countdown on stopped status', (done) => {
      let countdown = TestUtils.renderIntoDocument(<Countdown />);

      countdown.handleSetCountdown(3);
      countdown.handleStatusChange('stopped')

      setTimeout(() => {
        expect(countdown.state.count).toBe(0);
        expect(countdown.state.countdownStatus).toBe('stopped');
        done();
      }, 1001);
    });
  });
});
{'fraction_non_alphanumeric': 0.16118200134318333, 'fraction_numerical': 0.014775016789791807, 'mean_word_length': 3.0365853658536586, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 27, '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': '1081064', 'n_tokens_mistral': 917, 'n_tokens_neox': 866, 'n_words': 169}