-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
70 lines (61 loc) · 1.75 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/*!
* dirs <https://github.com/jonschlinkert/dirs>
*
* Copyright (c) 2014-2015, Jon Schlinkert.
* Licensed under the MIT License.
*/
'use strict';
/* deps:mocha */
var assert = require('assert');
var dirs = require('./');
describe('dirs', function () {
it('should throw an error when the callback is missing:', function () {
try {
dirs('foo');
} catch (err) {
assert(/dirs async expects a callback function/i.test(err));
}
});
it('should return an array of directories and files', function (done) {
dirs('fixtures', function (err, files) {
assert(Array.isArray(files));
assert(files.length > 1);
done();
});
});
it('should list directories', function (done) {
dirs('fixtures', function (err, files) {
assert(Array.isArray(files));
assert(files.length > 1);
assert(files.indexOf('fixtures/one') !== -1);
done();
});
});
it('should list files', function (done) {
dirs('fixtures', function (err, files) {
assert(Array.isArray(files));
assert(files.length > 1);
assert(files.indexOf('fixtures/a.js') !== -1);
done();
});
});
});
describe('dirs sync', function () {
it('should return an array of directories and files', function () {
var files = dirs.sync('fixtures');
assert(Array.isArray(files));
assert(files.length > 1);
});
it('should list directories', function () {
var files = dirs.sync('fixtures');
assert(Array.isArray(files));
assert(files.length > 1);
assert(files.indexOf('fixtures/one') !== -1);
});
it('should list files', function () {
var files = dirs.sync('fixtures');
assert(Array.isArray(files));
assert(files.length > 1);
assert(files.indexOf('fixtures/a.js') !== -1);
});
});