<commit_before>import chai from 'chai'
import chaiThings from 'chai-things'
import sinon from 'sinon'
import sinonChai from 'sinon-chai'
import fs from 'fs'
import { Track } from '../dist/bundle'
import fixtures from './fixtures'

const should = chai.should()

chai.use(chaiThings)
chai.use(sinonChai)

describe('Track', () => {
  describe('step', () => {
    let source = fixtures.fast.json
    let audio  = fixtures.fast.audio

    it('should play the current beat', done => {
      const track  = new Track({ source, audio })
      const wait   = source.headers['ms-per-beat']
      const stop   = sinon.spy()

      track.step = sinon.spy()

      track.start()

      setTimeout(() => {
        track.step.should.have.been.called

        done()
      }, wait + 5)
    }).timeout(0)

    it('should wait ms-per-beat between each step', () => {
    })<commit_msg>:microscope: test for ensuring that the duration between each step is accurate<commit_after>import chai from 'chai'
import chaiThings from 'chai-things'
import sinon from 'sinon'
import sinonChai from 'sinon-chai'
import fs from 'fs'
import { Track } from '../dist/bundle'
import fixtures from './fixtures'

const should = chai.should()

chai.use(chaiThings)
chai.use(sinonChai)

describe('Track', () => {
  describe('step', () => {
    let source = fixtures.fast.json
    let audio  = fixtures.fast.audio

    it('should play the current beat', done => {
      const track  = new Track({ source, audio })
      const wait   = source.headers['ms-per-beat']
      const stop   = sinon.spy()

      track.step = sinon.spy()

      track.start()

      setTimeout(() => {
        track.step.should.have.been.called

        done()
      }, wait + 5)
    }).timeout(0)

    it('should wait ms-per-beat between each step', done => {
      const track  = new Track({ source, audio })
      const wait   = source.headers['ms-per-beat']
      const steps  = 3
      const startTime = Date.now()
      let lastTime

      track.step = () => {
        lastTime = Date.now()
      }

      track.start()

      setTimeout(() => {
        const targetTime = startTime + (wait * steps)

        lastTime.should.be.closeTo(targetTime, 10)

        done()
      }, (wait * steps) + 5)
    }).timeout(0)
{'fraction_non_alphanumeric': 0.14241348713398402, 'fraction_numerical': 0.003992901508429458, 'mean_word_length': 2.5680379746835444, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '5587541', 'n_tokens_mistral': 744, 'n_tokens_neox': 706, 'n_words': 194}