<commit_before>import * as assert from 'power-assert';
import * as sinon from 'sinon';
import { test, Beater } from '../../src/';

class MockReporter {
  finished(files: string[], errors: { [file: string]: Error[]; }): void { }
  started(files: string[]): void { }
  fileFinished(file: string, errors: Error[]): void { }
  fileStarted(file: string): void { }
  testFinished(file: string, test: string, error?: Error): void { }
  testStarted(file: string, test: string): void { }
}

test('success', () => {
  const sandbox = sinon.sandbox.create();
  const reporter = new MockReporter();
  const started = sandbox.stub(reporter, 'started');
  const finished = sandbox.stub(reporter, 'finished');
  const fileStarted = sandbox.stub(reporter, 'fileStarted');
  const fileFinished = sandbox.stub(reporter, 'fileFinished');
  const testStarted = sandbox.stub(reporter, 'testStarted');
  const testFinished = sandbox.stub(reporter, 'testFinished');
  const beater = new Beater({
    reporter,
    files: ['./.tmp/test/fixture/success.js']
  });
  return beater.start().then(() => {
    const startedArgs = started.getCall(0).args;
    assert.deepEqual(
      startedArgs,
      [
        ['./.tmp/test/fixture/success.js']
      ]);
    const finishedArgs = finished.getCall(0).args;
    assert.deepEqual(
      finishedArgs,
      [
        ['./.tmp/test/fixture/success.js'],
        { './.tmp/test/fixture/success.js': [] }
      ]);
    const fileStartedArgs = fileStarted.getCall(0).args;
    assert.deepEqual(<commit_msg>fix test name<commit_after>import * as assert from 'power-assert';
import * as sinon from 'sinon';
import { test, Beater } from '../../src/';

class MockReporter {
  finished(files: string[], errors: { [file: string]: Error[]; }): void { }
  started(files: string[]): void { }
  fileFinished(file: string, errors: Error[]): void { }
  fileStarted(file: string): void { }
  testFinished(file: string, test: string, error?: Error): void { }
  testStarted(file: string, test: string): void { }
}

test('run success', () => {
  const sandbox = sinon.sandbox.create();
  const reporter = new MockReporter();
  const started = sandbox.stub(reporter, 'started');
  const finished = sandbox.stub(reporter, 'finished');
  const fileStarted = sandbox.stub(reporter, 'fileStarted');
  const fileFinished = sandbox.stub(reporter, 'fileFinished');
  const testStarted = sandbox.stub(reporter, 'testStarted');
  const testFinished = sandbox.stub(reporter, 'testFinished');
  const beater = new Beater({
    reporter,
    files: ['./.tmp/test/fixture/success.js']
  });
  return beater.start().then(() => {
    const startedArgs = started.getCall(0).args;
    assert.deepEqual(
      startedArgs,
      [
        ['./.tmp/test/fixture/success.js']
      ]);
    const finishedArgs = finished.getCall(0).args;
    assert.deepEqual(
      finishedArgs,
      [
        ['./.tmp/test/fixture/success.js'],
        { './.tmp/test/fixture/success.js': [] }
      ]);
    const fileStartedArgs = fileStarted.getCall(0).args;
    assert.deepEqual(
{'fraction_non_alphanumeric': 0.1680892974392646, 'fraction_numerical': 0.001969796454366382, 'mean_word_length': 3.561377245508982, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '1028158', 'n_tokens_mistral': 986, 'n_tokens_neox': 1000, 'n_words': 212}