So, I'm trying to ridicule or drown out the call to growl . If necessary, a function is returned that will trigger a notification of the lever when called. I can't figure out how to taunt or drown it out in my tests.
This is what I have tried so far:
var growl = require('growl');
exports.some_func = function() {
growl('A message', { title: 'Title' });
};
(Note: I use sinon-chai for my statements)
var growl = require('growl')
, some_code = require('../lib/some_code');
describe('Some code', function() {
it('sends a growl notification', function(done) {
var growlStub = sinon.stub(growl);
some_code.some_func();
growlStub.should.have.been.called;
done();
});
});
source
share