<commit_before>describe('$change emitter - instances - listener - removal', function() {

  var Observable = require('../../lib/observable')
  var util = require('../../lib/util')
  var measure = {
    a:{},
    b:{},
    c:{},
    aRef:{},
    bRef:{}
  }
  var aRef
  var bRef
  var a
  var b
  var c

  it( 'create new observable --> a, overwrite different types of keys', function() {    

     aRef = new Observable({
      $key: 'aRef',
      $val: 'a value for aRef'
     })

     a = new Observable({
      $key: 'a',
      $on: {
        $change: {
          other: function() {},
          special: function() {}
        }
      },
      $val: 1
     })

     console.log(a.$on.$change.$fn)

     a.$set({
      $on: {
        $change: {
          special: [ function() {
            console.log('passon!')
          }, aRef ]
        }
      }
     })


     //same for passon and base
     expect( a.$on.$change.$fn.other ).msg('$fn.other').to.be.ok
     expect( a.$on.$change.$fn.special ).msg('$fn.special').to.be.null

     //remove fn if its completely empty
     a.$on.$change.$fn.$removeProperty( a.$on.$change.$fn.other, 'other' )

     console.info('ghello why is it gone???!@#', a.$on.$change.$fn)
     console.info(util.isEmpty(a.$on.$change.$fn))

     expect( a.$on.$change.$fn ).msg('$fn').to.be.null
    
  })

})<commit_msg>added overwrite tests for on #40<commit_after>describe('$change emitter - instances - listener - removal', function() {

  var Observable = require('../../lib/observable')
  var util = require('../../lib/util')
  var measure = {
    a:{},
    b:{},
    c:{},
    aRef:{},
    bRef:{}
  }
  var aRef
  var bRef
  var a
  var b
  var c

  it( 'create new observable --> a, overwrite different types of keys', function() {    

     aRef = new Observable({
      $key: 'aRef',
      $val: 'a value for aRef'
     })

     a = new Observable({
      $key: 'a',
      $on: {
        $change: {
          other: function() {},
          special: function() {}
        }
      },
      $val: 1
     })

     a.$set({
      $on: {
        $change: {
          special: [ function() {
            console.log('passon!')
          }, aRef ]
        }
      }
     })

     //same for passon and base
     expect( a.$on.$change.$fn.other ).msg('$fn.other').to.be.ok
     expect( a.$on.$change.$fn.special ).msg('$fn.special').to.be.null

     //remove fn if its completely empty
     a.$on.$change.$fn.$removeProperty( a.$on.$change.$fn.other, 'other' )

     expect( a.$on.$change.$fn ).msg('$fn').to.be.null
    
  })

  it( 'new observable --> a --> b, overwrite listener on b', function() {

    a = new Observable({
      $key: 'a',
      $on: {
        $change: {
          other: function() {},
          special: function() {}
        }
      },
      $val: 1
    })

    b = new a.$Constructor({
      $key: 'b',
      $on: {
        $change: {
          other:function() {}
        }
      }
    })

    expect(b.$on.$change.$fn.special).to.equal(a.$on.$change.$fn.special)
    expect(b.$on.$change.$fn.other).to.not.equal(a.$on.$change.$fn.other)
    expect(b.$on).to.be.an.instanceof( a.$on.$Constructor )
    expect(b.$on.$change.$fn).to.be.an.instanceof(a.$on.$change.$fn.$Constructor)

  })

})
{'fraction_non_alphanumeric': 0.19883040935672514, 'fraction_numerical': 0.0015389350569405972, 'mean_word_length': 1.8017241379310345, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '5709475', 'n_tokens_mistral': 1125, 'n_tokens_neox': 1085, 'n_words': 235}