Skip to content

Instantly share code, notes, and snippets.

@jeffmo
Created May 16, 2014 17:47
Show Gist options
  • Save jeffmo/0f6e81a82ed0c4a3e585 to your computer and use it in GitHub Desktop.
Save jeffmo/0f6e81a82ed0c4a3e585 to your computer and use it in GitHub Desktop.
describe('This is a test', function() {
it('is only a test', function() {
var SomeEmitter = require('../SomeEmitter');
var emitter = new SomeEmitter;
emitter.on('foo').emit('bar');
expect(emitter.on).toBeCalledWith('foo');
expect(emitter.emit).toBeCalledWith('bar');
});
});
var SomeEmitter = require.generateMock('../SomeEmitter');
SomeEmitter.prototype.on.mockReturnThis();
SomeEmitter.prototype.emit.mockReturnThis();
module.exports = SomeEmitter;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment