<commit_before>var assert = require('assert');

var sinon = require('sinon')

var Cli = require('../src/cli.js').Diff2HtmlInterface;
var http = require('../src/http-utils.js').HttpUtils;
var Utils = require('../src/utils.js').Utils;

describe('Cli', function() {
  describe('getInput', function() {
    it('should readFile when inputType is `file`', function() {
      let spy = sinon.stub(Utils, 'readFile');
      Cli.getInput('file', ['lol', 'foo'], 'ignore', 'callback');
      assert(spy.calledOnce);
      assert(spy.calledWith('lol', 'callback'));
      spy.restore()
    });

    it('should readStdin when inputType is `stdin`', function() {
      let spy = sinon.stub(Utils, 'readStdin');
      Cli.getInput('stdin', ['lol'], 'ignore', 'callback');
      assert(spy.calledOnce);
      assert(spy.calledWith('callback'));
    });

    it('should _runGitDiff by default', function() {
      let spy = sinon.stub(Cli, '_runGitDiff');
      Cli.getInput('abc', ['lol', 'foo'], 'ignore', 'callback');
      assert(spy.calledOnce);
      assert(spy.calledWith(['lol', 'foo'], 'ignore', 'callback'));
    });
  });

  describe('preview', function() {
    it('should call `utils.writeFile`', function() {
      let spy = sinon.stub(Utils, 'writeFile');
      Cli.preview('a', 'b');
      assert(spy.calledOnce);
    });
  });

  describe('postToDiffy', function() {
    it('should call `http.post`', function() {
      let spy = sinon.stub(http, 'post');
      Cli.postToDiffy('a', 'b', 'callback');
      assert(spy.calledOnce);
      assert(spy.calledWith('http://diffy.org/api/new', { udiff: 'a' }));
    });
  });
});
<commit_msg>restore method from stub to original<commit_after>var assert = require('assert');

var sinon = require('sinon')

var Cli = require('../src/cli.js').Diff2HtmlInterface;
var http = require('../src/http-utils.js').HttpUtils;
var Utils = require('../src/utils.js').Utils;

describe('Cli', function() {
  describe('getInput', function() {
    it('should readFile when inputType is `file`', function() {
      let spy = sinon.stub(Utils, 'readFile');
      Cli.getInput('file', ['lol', 'foo'], 'ignore', 'callback');
      assert(spy.calledOnce);
      assert(spy.calledWith('lol', 'callback'));
      spy.restore();
    });

    it('should readStdin when inputType is `stdin`', function() {
      let spy = sinon.stub(Utils, 'readStdin');
      Cli.getInput('stdin', ['lol'], 'ignore', 'callback');
      assert(spy.calledOnce);
      assert(spy.calledWith('callback'));
      spy.restore();
    });

    it('should _runGitDiff by default', function() {
      let spy = sinon.stub(Cli, '_runGitDiff');
      Cli.getInput('abc', ['lol', 'foo'], 'ignore', 'callback');
      assert(spy.calledOnce);
      assert(spy.calledWith(['lol', 'foo'], 'ignore', 'callback'));
    });
  });

  describe('preview', function() {
    it('should call `utils.writeFile`', function() {
      let spy = sinon.stub(Utils, 'writeFile');
      Cli.preview('a', 'b');
      assert(spy.calledOnce);
      spy.restore();
    });
  });

  describe('postToDiffy', function() {
    it('should call `http.post`', function() {
      let spy = sinon.stub(http, 'post');
      Cli.postToDiffy('a', 'b', 'callback');
      assert(spy.calledOnce);
      assert(spy.calledWith('http://diffy.org/api/new', { udiff: 'a' }));
    });
  });
});

{'fraction_non_alphanumeric': 0.21252997601918466, 'fraction_numerical': 0.0005995203836930455, 'mean_word_length': 3.4973045822102424, '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': '6371828', 'n_tokens_mistral': 1124, 'n_tokens_neox': 1109, 'n_words': 217}