<commit_before>'use strict';

const utils = require('../lib/utils');
const expect = require('chai').expect;


describe('utils', () => {
  describe('hasCallback', () => {
    it('should return true', () => {
      // standard
      let passed = utils.hasCallback(function test(err, cb) { // eslint-disable-line
        cb();
      });
      expect(passed).to.equal(true);

      // anonymous
      passed = utils.hasCallback((err, callback) => {
        callback();
      });
      expect(passed).to.equal(true);

      // class
      class FakeClass {
        foo(err, done) {
          done();
        }
      }
      const fakey = new FakeClass();
      passed = utils.hasCallback(fakey.foo);
      expect(passed).to.equal(true);
    });

    it('should return false', () => {
      // standard
      let passed = utils.hasCallback(function bleh(test) { /* foo */ }); // eslint-disable-line
      expect(passed).to.equal(false);

      // anonymous
      passed = utils.hasCallback(() => {});
      expect(passed).to.equal(false);

      // anonymous, single arg fat arrow
      passed = utils.hasCallback(foo =>
        `${foo}bar`
      );
      expect(passed).to.equal(false);

      // class
      class FakeClass {
        foo() {}<commit_msg>Add true test case<commit_after>'use strict';

const utils = require('../lib/utils');
const expect = require('chai').expect;


describe('utils', () => {
  describe('hasCallback', () => {
    it('should return true', () => {
      // standard
      let passed = utils.hasCallback(function test(err, cb) { // eslint-disable-line
        cb();
      });
      expect(passed).to.equal(true);

      // anonymous
      passed = utils.hasCallback((err, callback) => {
        callback();
      });
      expect(passed).to.equal(true);

      // anonymous, single arg fat arrow
      passed = utils.hasCallback(callback =>
        callback()
      );
      expect(passed).to.equal(true);

      // class
      class FakeClass {
        foo(err, done) {
          done();
        }
      }
      const fakey = new FakeClass();
      passed = utils.hasCallback(fakey.foo);
      expect(passed).to.equal(true);
    });

    it('should return false', () => {
      // standard
      let passed = utils.hasCallback(function bleh(test) { /* foo */ }); // eslint-disable-line
      expect(passed).to.equal(false);

      // anonymous
      passed = utils.hasCallback(() => {});
      expect(passed).to.equal(false);

      // anonymous, single arg fat arrow
      passed = utils.hasCallback(foo =>
        `${foo}bar`
      );
      expect(passed).to.equal(false);

      // class
      class FakeClass {
        foo() {}
{'fraction_non_alphanumeric': 0.16974030861874295, 'fraction_numerical': 0.0, 'mean_word_length': 2.087108013937282, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 18, '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': '1634030', 'n_tokens_mistral': 795, 'n_tokens_neox': 781, 'n_words': 150}