import { describe, it as test } from 'kocha'
import t from 'assert'
import EventEmitter from './index.js'

describe('event-emitter', () => {
  test('on', () => {
    const emitter = new EventEmitter()
    const type = 'foo'
    const func = () => {}
    emitter.on(type, func)
    t.ok(emitter._handlers.get(type).has(func))
  })
  describe('off', () => {
    const emitter = new EventEmitter()

    test('defined type', () => {
      const type = 'foo'
      const func = () => {}
      emitter.on(type, func)
      t.ok(emitter.off(type, func))
      t.ifError(emitter.off(type, () => {}))
    })
    test('undefined type', () => {
      t.ifError(emitter.off('undefined type', () => {}))
    })
  })
  test('emit', done => {
    const emitter = new EventEmitter()
    const type = 'foo'
    const data = 'baz'
    const func = arg => {
      t.equal(arg, data)
      done()
    }
    emitter.on(type, func)
    emitter.emit(type, data)
  })
})

@@ -140,17 +140,145 @@
 %7B%0A  
-test('on'
+describe('on', () =%3E %7B%0A    test('string', () =%3E %7B%0A      const emitter = new EventEmitter()%0A      const type = 'foo'%0A      emitter.on(type
 , ()
@@ -274,33 +274,104 @@
 on(type, () =%3E %7B
+%7D)%0A
 %0A
+      t.ok(emitter._has(type))%0A    %7D)%0A%0A    test('symbol', () =%3E %7B%0A  
     const emitte
@@ -389,32 +389,34 @@
 ntEmitter()%0A    
+  
 const type = 'fo
@@ -404,38 +404,253 @@
    const type = 
+Symbol(
 'foo'
+)
 %0A
+      emitter.on(type, () =%3E %7B%7D)%0A%0A      t.ok(emitter._has(type))%0A    %7D)%0A%0A    test('2 handlers', () =%3E %7B%0A      const emitter = new EventEmitter()%0A      const type0 = 'foo'%0A      const type1 = Symbol('foo')%0A  
     const func =
@@ -659,24 +659,26 @@
 ) =%3E %7B%7D%0A    
+ 
+ 
 emitter.on(t
@@ -680,28 +680,70 @@
 .on(type
+0
 , 
-func)%0A
+() =%3E %7B%7D)%0A      emitter.on(type1, () =%3E %7B%7D)%0A%0A 
     
+ 
 t.ok(emi
@@ -754,41 +754,63 @@
 ._ha
-ndlers.get(type).has(func)
+s(type0))%0A      t.ok(emitter._has(type1))%0A    %7D
 )%0A  %7D)%0A
+%0A
   de
@@ -827,24 +827,79 @@
 f', () =%3E %7B%0A
+    test('defined type and defined handler', () =%3E %7B%0A  
     const em
@@ -928,42 +928,8 @@
 er()
-%0A%0A    test('defined type', () =%3E %7B
 %0A   
@@ -1003,24 +1003,25 @@
 type, func)%0A
+%0A
       t.ok(e
@@ -1044,16 +1044,207 @@
  func))%0A
+    %7D)%0A%0A    test('defined type and undefined handler', () =%3E %7B%0A      const emitter = new EventEmitter()%0A      const type = 'foo'%0A      emitter.on(type, () =%3E %7B%0A        return 'foo'%0A      %7D)%0A%0A
       t.
@@ -1287,16 +1287,17 @@
 %0A    %7D)%0A
+%0A
     test
@@ -1319,24 +1319,65 @@
 e', () =%3E %7B%0A
+      const emitter = new EventEmitter()%0A
       t.ifEr
@@ -1428,21 +1428,22 @@
 %0A    %7D)%0A
-
   %7D)%0A
+%0A
   test('

improve tests