<commit_before>import should from 'should/as-function'
import sinon from 'sinon'
import EventEmitter from 'eventemitter3'

import ServiceNode from './ServiceNode'

describe('ServiceNode(settings)', function () {
  it('should be a function', () => { should(ServiceNode).be.a.Function() })
  it('should throw if settings.backendSetupTimeout is not integer or is < 1', () => {
    function throwing () {
      ServiceNode({backendSetupTimeout: ''})
    }
    function throwing2 () {
      ServiceNode({backendSetupTimeout: 0})
    }
    should(throwing).throw()
    should(throwing2).throw()
  })
  it('should warn if settings.backendSetupTimeout is lower than 500', () => {
    let stub = sinon.stub(console, 'warn', () => {})
    ServiceNode({backendSetupTimeout: 499})
    should(stub.called).equal(true)
    stub.restore()
  })
  describe('serviceNode', () => {
    it('should be an instance of EventEmitter', () => {
      let node = ServiceNode()
      should(node).be.an.instanceof(EventEmitter)
    })<commit_msg>readability<commit_after>import should from 'should/as-function'
import sinon from 'sinon'
import EventEmitter from 'eventemitter3'

import ServiceNode from './ServiceNode'

describe('ServiceNode(settings)', function () {
  it('should be a function', () => { should(ServiceNode).be.a.Function() })
  it('should throw if settings.backendSetupTimeout is not integer or is < 1', () => {
    function throwing () {
      ServiceNode({backendSetupTimeout: ''})
    }
    function throwing2 () {
      ServiceNode({backendSetupTimeout: 0})
    }
    should(throwing).throw()
    should(throwing2).throw()
  })
  it('should console.warn() if settings.backendSetupTimeout is lower than 500', () => {
    sinon.stub(console, 'warn', () => {})
    ServiceNode({backendSetupTimeout: 499})
    should(console.warn.called).equal(true)
    console.warn.restore()
  })
  describe('serviceNode', () => {
    it('should be an instance of EventEmitter', () => {
      let node = ServiceNode()
      should(node).be.an.instanceof(EventEmitter)
    })
{'fraction_non_alphanumeric': 0.15324548560273304, 'fraction_numerical': 0.010736944851146901, 'mean_word_length': 3.963680387409201, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, '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': '3715712', 'n_tokens_mistral': 608, 'n_tokens_neox': 599, 'n_words': 136}