notify tests: use stubs, better labels

This commit is contained in:
oleg 2015-06-12 15:04:29 +03:00
parent ecf890d20c
commit 6d50b6ba06

View File

@ -9,17 +9,13 @@ describe('notifier module', function() {
function TestNotifier() { function TestNotifier() {
} }
TestNotifier.prototype.init = sinon.spy(function(params, callback) { TestNotifier.prototype.init = sinon.stub().callsArg(1);
callback(); TestNotifier.prototype.send = sinon.stub().callsArg(1);
});
TestNotifier.prototype.send = sinon.spy(function(params, callback) {
callback();
});
var sendSpy = TestNotifier.prototype.send; var sendSpy = TestNotifier.prototype.send;
describe('before test', function() { describe('test notifier', function() {
it('should allow rigester test notifier', function() { it('should be rigestered', function() {
notifier.register('test', TestNotifier); notifier.register('test', TestNotifier);
}); });
@ -27,7 +23,7 @@ describe('notifier module', function() {
notifier.init({}, done); notifier.init({}, done);
}); });
it('test notifier init method should be called during init', function() { it('init method should be called once during init', function() {
expect(TestNotifier.prototype.init.calledOnce).equal(true); expect(TestNotifier.prototype.init.calledOnce).equal(true);
}); });
}); });