const {assert} = require('chai')
const {CallbacksRegistry} = require('electron')

describe('CallbacksRegistry module', () => {
  let registry = null

  beforeEach(() => {
    registry = new CallbacksRegistry()
  })

  it('adds a callback to the registry', () => {
    const cb = () => [1, 2, 3, 4, 5]
    const key = registry.add(cb)

    assert.exists(key)
  })

  it('returns a specified callback if it is in the registry', () => {
    const cb = () => [1, 2, 3, 4, 5]
    const key = registry.add(cb)
    const callback = registry.get(key)

    assert.equal(callback.toString(), cb.toString())
  })

  it('returns an empty function if the cb doesnt exist', () => {
    const callback = registry.get(1)

    assert.isFunction(callback)
  })

  it('removes a callback to the registry', () => {
    const cb = () => [1, 2, 3, 4, 5]
    const key = registry.add(cb)

    assert.exists(key)

    const beforeCB = registry.get(key)

    assert.equal(beforeCB.toString(), cb.toString())

    registry.remove(key)
    const afterCB = registry.get(key)

    assert.isFunction(afterCB)
    assert.notEqual(afterCB.toString(), cb.toString())
  })
})

@@ -3,34 +3,114 @@
 nst 
-%7Bassert%7D = require('chai')
+chai = require('chai')%0Aconst dirtyChai = require('dirty-chai')%0A%0Aconst %7Bexpect%7D = chai%0Achai.use(dirtyChai)%0A
 %0Acon
@@ -412,33 +412,37 @@
 b)%0A%0A    
-assert
+expect(key).to
 .exist
-s(key
+(
 )%0A  %7D)%0A%0A
@@ -625,28 +625,22 @@
 y)%0A%0A    
-assert.equal
+expect
 (callbac
@@ -643,34 +643,40 @@
 lback.toString()
-, 
+).equal(
 cb.toString())%0A 
@@ -791,34 +791,43 @@
     
-assert.isFunction(callback
+expect(callback).to.be.a('function'
 )%0A  
@@ -956,126 +956,8 @@
 b)%0A%0A
-    assert.exists(key)%0A%0A    const beforeCB = registry.get(key)%0A%0A    assert.equal(beforeCB.toString(), cb.toString())%0A%0A
     
@@ -1024,54 +1024,54 @@
     
-assert.isFunction(afterCB)%0A    assert.notEqual
+expect(afterCB).to.be.a('function')%0A    expect
 (aft
@@ -1085,18 +1085,31 @@
 String()
-, 
+).to.not.equal(
 cb.toStr

update callback registry spec to expect (#13263)