<commit_before>'use strict';

var chai = require('chai');
var expect = chai.expect;
var sinon = require('sinon');
chai.use(require('sinon-chai'));

var callable = require('../../lib/util/callable');
var getPrototypeOf = require('../../lib/util/proto').getPrototypeOf;

describe('callable', function() {

  beforeEach(function() {
    this.constructorSpy = sinon.spy();
    this.callSpy = sinon.spy();
    this.Callable = callable(this.constructorSpy);
    this.Callable.prototype.call = this.callSpy;
  });

  it('returns a class', function() {
    expect(this.Callable.prototype).to.exist;
  });

  describe('instance', function() {
    beforeEach(function() {
      this.instance = new this.Callable('creating', 'callable');
    });
    it('exists', function() {
      expect(this.instance).to.exist;
    });
    it('calls the constructor', function() {
      expect(this.constructorSpy).to.have.been.calledOnce;
    });
    it('uses callable object in constructor', function() {
      expect(this.constructorSpy.firstCall.thisValue).to.equal(this.instance);
    });
    it('passes arguments through to the constructor', function() {
      expect(this.constructorSpy).to.have.been.calledWithExactly('creating', 'callable');
    });
    it('has a __proto__ set to the class prototype', function() {
      expect(getPrototypeOf(this.instance)).to.equal(this.Callable.prototype);
    });
    it('is a type of the class', function() {<commit_msg>Checking that callable is a function.<commit_after>'use strict';

var chai = require('chai');
var expect = chai.expect;
var sinon = require('sinon');
chai.use(require('sinon-chai'));

var callable = require('../../lib/util/callable');
var getPrototypeOf = require('../../lib/util/proto').getPrototypeOf;

describe('callable', function() {

  beforeEach(function() {
    this.constructorSpy = sinon.spy();
    this.callSpy = sinon.spy();
    this.Callable = callable(this.constructorSpy);
    this.Callable.prototype.call = this.callSpy;
  });

  it('returns a class', function() {
    expect(this.Callable.prototype).to.exist;
  });

  describe('instance', function() {
    beforeEach(function() {
      this.instance = new this.Callable('creating', 'callable');
    });
    it('exists', function() {
      expect(this.instance).to.exist;
    });
    it('calls the constructor', function() {
      expect(this.constructorSpy).to.have.been.calledOnce;
    });
    it('uses callable object in constructor', function() {
      expect(this.constructorSpy.firstCall.thisValue).to.equal(this.instance);
    });
    it('passes arguments through to the constructor', function() {
      expect(this.constructorSpy).to.have.been.calledWithExactly('creating', 'callable');
    });
    it('has a __proto__ set to the class prototype', function() {
      expect(getPrototypeOf(this.instance)).to.equal(this.Callable.prototype);
    });
    it('is a function', function() {
      expect(this.instance).to.be.a('function');
    });
    it('is a type of the class', function() {
{'fraction_non_alphanumeric': 0.17232202262142382, 'fraction_numerical': 0.0, 'mean_word_length': 3.85, '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': '2823433', 'n_tokens_mistral': 934, 'n_tokens_neox': 927, 'n_words': 174}