add readdirSyncRecursive and the test runner file.
This commit is contained in:
parent
29cb04590b
commit
139ed486f1
9 changed files with 86 additions and 3 deletions
30
tests/readdirSyncRecursive.js
Normal file
30
tests/readdirSyncRecursive.js
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
var testCase = require('nodeunit').testCase;
|
||||
var fs = require('fs');
|
||||
var wrench = require('wrench');
|
||||
var path = require('path');
|
||||
|
||||
module.exports = testCase({
|
||||
test_readdirSyncRecursive: function(test) {
|
||||
var dir = __dirname + '/readdir';
|
||||
|
||||
test.equals(path.existsSync(dir), true, 'Folders should exist');
|
||||
|
||||
var check = [
|
||||
'bar.txt',
|
||||
'foo',
|
||||
'foo/bar',
|
||||
'foo/dolor.md',
|
||||
'foo/lorem.txt',
|
||||
'foo/bar/ipsum.js'
|
||||
];
|
||||
|
||||
var files = wrench.readdirSyncRecursive(dir);
|
||||
|
||||
test.equals(files.length, check.length, 'number of paths is correct');
|
||||
test.deepEqual(files, check, 'list shows all files and folders');
|
||||
|
||||
test.done();
|
||||
}
|
||||
});
|
||||
|
||||
// vim: et ts=4 sw=4
|
||||
Reference in a new issue