Skip to content

Instantly share code, notes, and snippets.

@jslatts
Created June 1, 2011 05:32
Show Gist options
  • Save jslatts/1001829 to your computer and use it in GitHub Desktop.
Save jslatts/1001829 to your computer and use it in GitHub Desktop.
testing question
<snipped>
var watchFolderTree = function (fPath, fn) {
if (typeof fn !== 'function') {
throw {
name: 'TypeError',
message: 'fn must be a function'
};
}
//Do lots of things to watch the folder tree
//How to test all this stuff?
return fn && fn();
};
exports.watch = function(reqPath, fn) {
var nPath = path.resolve(reqPath);
path.exists(nPath, function onExistsReturn(exists) {
if (!exists) {
nPath = nPath || '';
return fn && fn('Path does not exist: ' + nPath);
}
watchFolderTree(nPath, fn);
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment