<commit_before>var expect = require('chai').expect;
var mock = require('../util/mock');
var fsutil = require('../util/fsutil');
var EOL = require('os').EOL;
var input= require('../..')
  , history = input.history
  , History = input.History;

describe('cli-input:', function() {
  var stash;

  it('should create history instance', function(done) {
    var h = history({});
    expect(h).to.be.instanceof(History);
    done();
  });

  it('should create history file', function(done) {
    history({file: mock.file}, function(err, store, history) {
      stash = store;
      expect(err).to.eql(null);
      expect(stash.isFlushed()).to.eql(true);
      var contents = fsutil.text(mock.file);
      console.dir(stash.stats());
      expect(contents).to.eql('');
      expect(stash.history()).to.eql([]);
      done();
    });
  });

  it('should add history line', function(done) {
    stash.add(mock.lines[0], function(err) {
      expect(err).to.eql(null);
      expect(stash.isFlushed()).to.eql(true);<commit_msg>Assert on stats().<commit_after>var expect = require('chai').expect;
var mock = require('../util/mock');
var fsutil = require('../util/fsutil');
var EOL = require('os').EOL;
var input= require('../..')
  , history = input.history
  , History = input.History;

describe('cli-input:', function() {
  var stash;

  it('should create history instance', function(done) {
    var h = history({});
    expect(h).to.be.instanceof(History);
    done();
  });

  it('should create history file', function(done) {
    history({file: mock.file}, function(err, store, history) {
      stash = store;
      expect(err).to.eql(null);
      expect(stash.isFlushed()).to.eql(true);
      var contents = fsutil.text(mock.file);
      expect(stash.stats()).to.be.an('object');
      expect(contents).to.eql('');
      expect(stash.history()).to.eql([]);
      done();
    });
  });

  it('should add history line', function(done) {
    stash.add(mock.lines[0], function(err) {
      expect(err).to.eql(null);
      expect(stash.isFlushed()).to.eql(true);
{'fraction_non_alphanumeric': 0.20331545587518285, 'fraction_numerical': 0.0009751340809361287, 'mean_word_length': 3.4224137931034484, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6919611', 'n_tokens_mistral': 694, 'n_tokens_neox': 685, 'n_words': 127}