<commit_before>chai            = require 'chai'
sinon           = require 'sinon'
sinonChai       = require 'sinon-chai'
should          = chai.should()
expect          = chai.expect
assert          = chai.assert
chai.use(sinonChai)

inherits        = require 'inherits-ex/lib/inherits'
extend          = require 'util-ex/lib/_extend'
defineProperty  = require 'util-ex/lib/defineProperty'
PropertyManager = require '../src/ability'
Simple          = require '../src/simple'
Normal          = require '../src/normal'
Advance         = require '../src/advance'
test            = require './property-manager'
setImmediate    = setImmediate || process.nextTick


describe 'PropertyManagerAbility', ->
  checkProperty = (aClass)->
    aClass.should.have.ownProperty 'defineProperties'
    checkBasicProperty(aClass)
    
  checkBasicProperty = (aClass)->
    aClass::should.have.ownProperty 'assign'
    aClass::should.have.ownProperty 'assignPropertyTo'
    aClass::should.have.ownProperty 'initialize'
    aClass::should.have.ownProperty 'getProperties'
    aClass::should.have.ownProperty 'defineProperties'
    aClass::should.have.ownProperty 'assign',

  checkIsSame = (aClass, aManager)->
    aClass.should.be.have.property 'defineProperties', aManager.defineProperties
    checkBasicIsSame aClass, aManager
  checkBasicIsSame = (aClass, aManager)->
    aClass::should.be.have.property 'getProperties', aManager::getProperties
    aClass::should.be.have.property 'assignPropertyTo', aManager::assignPropertyTo
    aClass::should.be.have.property 'defineProperties', aManager::defineProperties
    
  it 'should choose simple manager to a class', ->
    class A
      constructor: ->@initialize.apply @, arguments
      PropertyManager A, 'simple'
    checkBasicProperty A
    checkBasicIsSame A, Simple

  it 'should choose normal manager to a class', ->
    class A
      constructor: ->@initialize.apply @, arguments
      PropertyManager A, 'normal'
    checkProperty A
    checkIsSame A, Normal

  it 'should choose advance manager to a class', ->
    class A
      constructor: ->@initialize.apply @, arguments
      PropertyManager A, 'advance'
    checkProperty A
    checkIsSame A, Advance

  it 'should apply the ability to a class', ->
    class A
      constructor: ->@initialize.apply @, arguments
      PropertyManager A
    checkProperty A
    test('AbilityPropertyManagerA', A)

<commit_msg>+ test name option of ability<commit_after>chai            = require 'chai'
sinon           = require 'sinon'
sinonChai       = require 'sinon-chai'
should          = chai.should()
expect          = chai.expect
assert          = chai.assert
chai.use(sinonChai)

inherits        = require 'inherits-ex/lib/inherits'
extend          = require 'util-ex/lib/_extend'
defineProperty  = require 'util-ex/lib/defineProperty'
PropertyManager = require '../src/ability'
Simple          = require '../src/simple'
Normal          = require '../src/normal'
Advance         = require '../src/advance'
test            = require './property-manager'
setImmediate    = setImmediate || process.nextTick


describe 'PropertyManagerAbility', ->
  checkProperty = (aClass)->
    aClass.should.have.ownProperty 'defineProperties'
    checkBasicProperty(aClass)
    
  checkBasicProperty = (aClass)->
    aClass::should.have.ownProperty 'assign'
    aClass::should.have.ownProperty 'assignPropertyTo'
    aClass::should.have.ownProperty 'initialize'
    aClass::should.have.ownProperty 'getProperties'
    aClass::should.have.ownProperty 'defineProperties'
    aClass::should.have.ownProperty 'assign',

  checkIsSame = (aClass, aManager)->
    aClass.should.be.have.property 'defineProperties', aManager.defineProperties
    checkBasicIsSame aClass, aManager
  checkBasicIsSame = (aClass, aManager)->
    aClass::should.be.have.property 'getProperties', aManager::getProperties
    aClass::should.be.have.property 'assignPropertyTo', aManager::assignPropertyTo
    aClass::should.be.have.property 'defineProperties', aManager::defineProperties
    
  it 'should choose simple manager to a class', ->
    class A
      constructor: ->@initialize.apply @, arguments
      PropertyManager A, 'simple'
    checkBasicProperty A
    checkBasicIsSame A, Simple

  it 'should choose simple manager to a class with name option', ->
    class A
      constructor: ->@initialize.apply @, arguments
      PropertyManager A, name:'simple'
    checkBasicProperty A
    checkBasicIsSame A, Simple

  it 'should choose normal manager to a class', ->
    class A
      constructor: ->@initialize.apply @, arguments
      PropertyManager A, 'normal'
    checkProperty A
    checkIsSame A, Normal

  it 'should choose advance manager to a class', ->
    class A
      constructor: ->@initialize.apply @, arguments
      PropertyManager A, 'advance'
    checkProperty A
    checkIsSame A, Advance

  it 'should apply the ability to a class', ->
    class A
      constructor: ->@initialize.apply @, arguments
      PropertyManager A
    checkProperty A
    test('AbilityPropertyManagerA', A)


{'fraction_non_alphanumeric': 0.10434782608695652, 'fraction_numerical': 0.0, 'mean_word_length': 3.2175, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 31, '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': '3795149', 'n_tokens_mistral': 1418, 'n_tokens_neox': 1401, 'n_words': 363}