<commit_before>/* eslint class-methods-use-this: 0 */
const expect = require('chai').expect;
const index = require('../index');

class BadOrsa {
  run(cb) {
    cb('Error!');
  }
}

class FakeOrsa {
  constructor(config) {
    FakeOrsa.created = this;
    this.config = config;
  }

  run(cb) {
    cb();
  }

  toObject() {
    return {
      foo: 'bar',
    };
  }
}

class FakeProgram {
  version(ver) {
    expect(ver).to.eql('0.0.3');
    return this;
  }

  option() {
    return this;
  }

  parse() {
    return this;
  }
}

describe('orsa-cli index', () => {
  it('should handle no path', () => {
    const fp = new FakeProgram();
    index({
      program: fp,
      fs: {
        readFileSync: () => JSON.stringify({
          version: '0.0.3',
        }),
      },
      console: {
        log: (text) => {
          expect(text).to.eql('No path specified');
        },
      },
      process: {
        exit: (status) => {
          expect(status).to.eql(1);
        },<commit_msg>Fixing version<commit_after>/* eslint class-methods-use-this: 0 */
const expect = require('chai').expect;
const index = require('../index');

class BadOrsa {
  run(cb) {
    cb('Error!');
  }
}

class FakeOrsa {
  constructor(config) {
    FakeOrsa.created = this;
    this.config = config;
  }

  run(cb) {
    cb();
  }

  toObject() {
    return {
      foo: 'bar',
    };
  }
}

class FakeProgram {
  version(ver) {
    expect(ver).to.be.defined;
    return this;
  }

  option() {
    return this;
  }

  parse() {
    return this;
  }
}

describe('orsa-cli index', () => {
  it('should handle no path', () => {
    const fp = new FakeProgram();
    index({
      program: fp,
      fs: {
        readFileSync: () => JSON.stringify({
          version: '0.0.3',
        }),
      },
      console: {
        log: (text) => {
          expect(text).to.eql('No path specified');
        },
      },
      process: {
        exit: (status) => {
          expect(status).to.eql(1);
        },
{'fraction_non_alphanumeric': 0.1816809260191243, 'fraction_numerical': 0.006542526421741319, 'mean_word_length': 1.8937409024745269, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '6798271', 'n_tokens_mistral': 718, 'n_tokens_neox': 709, 'n_words': 135}