const EventEmitter = require('events').EventEmitter;
const expect = require('expect');
const Context = require('../lib/context');
const createRobot = require('../lib/robot');

const nullLogger = {};
['trace', 'debug', 'info', 'warn', 'error', 'fatal'].forEach(level => {
  nullLogger[level] = function () { };
});

describe('Robot', function () {
  let webhook;
  let robot;
  let event;
  let callbacks;
  let spy;

  beforeEach(function () {
    callbacks = {};
    webhook = {
      on: (name, callback) => callbacks[name] = callback,
      emit: (name, event) => callbacks[name](event)
    };
    
    robot = createRobot({webhook, logger: nullLogger});
    robot.auth = () => {};

    event = {
      payload: {
        action: 'foo',
        installation: {id: 1}
      }
    }

    spy = expect.createSpy();
  });

  describe('on', function () {
    it('calls callback when no action is specified', async function () {
      robot.on('test', spy);

      expect(spy).toNotHaveBeenCalled();
      await webhook.emit('test', event);
      expect(spy).toHaveBeenCalled();
      expect(spy.calls[0].arguments[0]).toBe(event);
      expect(spy.calls[0].arguments[1]).toBeA(Context);
    });

    it('calls callback with same action', async function () {
      robot.on('test.foo', spy);

      await webhook.emit('test', event);
      expect(spy).toHaveBeenCalled();
    });

    it('does not call callback with different action', async function () {
      robot.on('test.nope', spy);

      await webhook.emit('test', event);
      expect(spy).toNotHaveBeenCalled();
    });
  });
});

@@ -1,57 +1,4 @@
-const EventEmitter = require('events').EventEmitter;%0A
 cons
@@ -445,24 +445,34 @@
 callback) =%3E
+ %7B%0A       
  callbacks%5Bn
@@ -486,16 +486,25 @@
 callback
+;%0A      %7D
 ,%0A      
@@ -525,16 +525,33 @@
 vent) =%3E
+ %7B%0A        return
  callbac
@@ -569,20 +569,25 @@
 ent)
-%0A
+;%0A  
     %7D
-;
 %0A    
+%7D;%0A
 %0A   
@@ -764,16 +764,17 @@
  %7D%0A    %7D
+;
 %0A%0A    sp

Fix lint errors