Skip to content
Browse files

Improved unit tests.

  • Loading branch information...
1 parent 69cf1d0 commit 1c42e7273a8c18e919ceb2e29381507a9faee141 bpedro committed Nov 7, 2012
Showing with 13 additions and 7 deletions.
  1. +13 −7 test/mkdir.test.js
View
20 test/mkdir.test.js
@@ -1,19 +1,25 @@
var fs = require('../lib/fs');
var assert = require('assert');
+// Define the base temporary directory where tests will be written
+var tmpBaseDir = '/tmp/_node-fs-test';
+
/**
* Tests the recursive creation of a directory
*/
exports.testRecursiveMkdir = function() {
- fs.mkdir('/tmp/example_dir/first/second/third/fourth/fifth', 0777, true, function (err) {
+ fs.mkdir(tmpBaseDir + '/a/b/c/d/e', 0777, true, function (err) {
assert.isUndefined(err);
});
}
-exports.testRecursiveSyncMkdir = function() {
- try {
- fs.mkdirSync('/tmp/example_sync/first/second/third/fourth/fifth', 0777, true);
- } catch (e) {
- console.log(e);
- }
+/**
+ * Tests the synchronous creation of a directory
+ */
+exports.testRecursiveMkdirSync = function() {
+ assert.doesNotThrow(
+ function () {
+ fs.mkdirSync(tmpBaseDir + '/_sync/a/b/c/d/e', 0777, true);
+ }
+ );
}

0 comments on commit 1c42e72

Please sign in to comment.
Something went wrong with that request. Please try again.