<commit_before>import expect, { spyOn, createSpy } from 'expect'
import * as utils from '../src/utils'

describe('`toType()`', () => {

  it('should call `withRequired` on passed in object', () => {
    const obj = {}

    utils.toType(obj)
    expect(obj.hasOwnProperty('isRequired')).toBe(true)

  })

  it('should call `withDefault` on passed in object', () => {
    const obj = {}

    utils.toType(obj)
    expect(obj.def).toBeA(Function)

  })

  // it('should bind provided `validator function to the passed in object`', () => {
  //   const obj = {
  //     validator() {
  //       return this
  //     }
  //   }
  //
  //   const type = utils.toType(obj)
  //   const validator = type.validator
  //
  //   expect(validator()).toBe(obj)
  // })

})<commit_msg>enableing tests for valodator function<commit_after>import expect, { spyOn, createSpy } from 'expect'
import * as utils from '../src/utils'

describe('`toType()`', () => {

  it('should enhance the passed-in object without cloning', () => {
    const obj = {}

    const type = utils.toType('testType', obj)
    expect(type).toBe(obj)

  })

  it('should call `withRequired` on passed in object', () => {
    const obj = {}

    utils.toType('testType', obj)
    expect(obj.hasOwnProperty('isRequired')).toBe(true)

  })

  it('should call `withDefault` on passed in object', () => {
    const obj = {}

    utils.toType('testType', obj)
    expect(obj.def).toBeA(Function)

  })

  it('should bind provided `validator function to the passed in object`', () => {
    const obj = {
      validator() {
        return this
      }
    }

    const type = utils.toType('testType', obj)
    const validator = type.validator

    expect(validator()).toBe(obj)
  })

})
{'fraction_non_alphanumeric': 0.1707035755478662, 'fraction_numerical': 0.0, 'mean_word_length': 2.7799564270152506, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 12, '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': '6843487', 'n_tokens_mistral': 568, 'n_tokens_neox': 558, 'n_words': 133}