it('calls the original function', function () {
var callback = sinon.spy();
var proxy = once(callback);
proxy();
assert(callback.called);
});
var handler = function(callback){
//stupid handler that makes every file urgent
fs.readFile("/this/path/does/not/exist/", function(err, data) {
if (err) {
console.log(err)
}
callback(data+"!!!!");
})
}
module.exports = handler
var fs = require('fs');
var sinon = require('sinon');
sinon.stub(fs, 'readFile').yields(null, "LOLYESITDOES")
var test = require('tape');
var handler = require('./script.js')
test ('test the urgent handler', function(t){
handler(function(data){
t.equal(data, "LOLYESITDOES!!!!")
t.end()
})
});