-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
46 lines (40 loc) · 1.08 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
var test = require('ava'),
m = require('./');
/* eslint one-var: 0 */
var output = {
dirnames: [
'fixtures/ok-dir',
'fixtures/ok-dir/valid-dir'
],
filenames: [
'fixtures/normal-file',
'fixtures/ok-dir/im-link-to-valid-dir',
'fixtures/ok-dir/valid-dir/im-borken-link',
'fixtures/ok-dir/valid-dir/im-circular-link',
'fixtures/ok-dir/valid-dir/im-outsider-dir-link',
'fixtures/ok-dir/valid-dir/im-outsider-file-link'
],
errors: []
};
if (process.platform === 'win32') {
var types = ['dirnames', 'filenames'];
for (var i = 0; i < types.length; i +=1 ) {
for(var j = 0; j < output[types[i]].length; j +=1) {
output[types[i]][j] = output[types[i]][j].replace(/\//g, '\\');
}
}
}
test.cb('callback-impl', function(t) {
m('fixtures', function(result) {
result.dirnames.sort();
result.filenames.sort();
t.deepEqual(result, output);
t.end();
});
});
test('sync-impl-dfs', function(t) {
t.deepEqual(m.sync('fixtures', {dfs: true}), output);
});
test('sync-impl-bfs', function(t) {
t.deepEqual(m.sync('fixtures'), output);
});