0.0.0 • Published 10 years ago
stubbie v0.0.0
Stubbie - easy async testing
test.js
var Stubbie = require('stubbie');
var fs = require('fs');
var app = require('./appCode.js');
var readFileStub = new Stubbie(fs, 'readFile', null, "Instead of calling readFile, just callback with this result instead");
app.functionToUnitTest(); // will call our stubbed readFile method
appCode.js
var functionToUnitTest = function() {
...
fs.readFile(someFile, function(err, contents) {
// continues on with what we want to test
...
});
};
0.0.0
10 years ago