Skip to content

Instantly share code, notes, and snippets.

@reneviering
Created December 2, 2015 14:43
Show Gist options
  • Save reneviering/90d3fc6b6719979057d0 to your computer and use it in GitHub Desktop.
Save reneviering/90d3fc6b6719979057d0 to your computer and use it in GitHub Desktop.
var chai = require('chai');
var expect = chai.expect;
var sinon = require('sinon');
var sinonChai = require('sinon-chai');
chai.use(sinonChai);
var eventBus = (function () {
var _eventHandler = null;
return {
registerEventHandler: function(eventHandler) {
_eventHandler = eventHandler;
},
emit: function() {
_eventHandler();
}
}
})();
describe('EventBus', function () {
it('should call all registered EventHandler', function () {
var callback = sinon.spy();
eventBus.registerEventHandler(callback);
//eventBus.emit();
expect(callback).to.have.been.called;
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment