-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtests.js
More file actions
44 lines (40 loc) · 1.02 KB
/
tests.js
File metadata and controls
44 lines (40 loc) · 1.02 KB
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
var sort = require('./index');
var sortFiles = sort.sortFiles;
var input = [{
path: 'app.module.js'
}, {
path: 'first/first.service.js'
}, {
path: 'second/second.controller.js'
}, {
path: 'second/second.service.js'
}, {
path: 'first/third/third.service.js'
}, {
path: 'first/first.controller.js'
}, {
path: 'app.routes.js'
}, {
path: 'first/fourth/fourth.service.js'
}, {
path: 'core/core.module.js'
}, {
path: 'common/common.module.js'
}];
var expected = [
'core/core.module.js',
'common/common.module.js',
'first/fourth/fourth.service.js',
'first/third/third.service.js',
'first/first.service.js',
'first/first.controller.js',
'second/second.service.js',
'second/second.controller.js',
'app.routes.js',
'app.module.js'
];
var result = sortFiles(input, {
types: ['service', 'controller', 'routes', 'module'],
special: ['core', 'common']
}).map(f => f.path);
console.assert(result.toString() === expected.toString(), 'result is not as expected', result);