0.0.0 • Published 12 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 methodappCode.js
var functionToUnitTest = function() {
...
fs.readFile(someFile, function(err, contents) {
// continues on with what we want to test
...
});
};0.0.0
12 years ago