@@ -21,18 +21,24 @@ const CONFIG_FILES_PRIORITY = [
21
21
'routes.js' ,
22
22
] ;
23
23
24
+ const getTestSorting = config => ( file1 , file2 , sortRes ) => {
25
+ return [ config , cb => cb ( file1 , file2 ) === sortRes ] ;
26
+ } ;
27
+ const testSorting = getTestSorting ( CONFIG_FILES_PRIORITY ) ;
28
+
24
29
metatests . case (
25
30
'Common / sort' ,
26
31
{ common } ,
27
32
{
28
33
'common.sortComparePriority' : [
29
- [ CONFIG_FILES_PRIORITY , res => res ( 'files.js' , 'sandbox.js' ) === 1 ] ,
30
- [ CONFIG_FILES_PRIORITY , res => res ( 'filestorage.js' , 'routes.js' ) === - 1 ] ,
31
- [ CONFIG_FILES_PRIORITY , res => res ( 'unknown.js' , 'sandbox.js' ) === 1 ] ,
32
- [ CONFIG_FILES_PRIORITY , res => res ( 'log.js' , 'sandbox.js' ) === 1 ] ,
33
- [ CONFIG_FILES_PRIORITY , res => res ( 'sandbox.js' , 'sandbox.js' ) === 0 ] ,
34
- [ CONFIG_FILES_PRIORITY , res => res ( 'log.js' , 'log.js' ) === 0 ] ,
35
- [ CONFIG_FILES_PRIORITY , res => res ( 'tasks.js' , 'application.js' ) === - 1 ] ,
34
+ testSorting ( 'files.js' , 'sandbox.js' , 1 ) ,
35
+ testSorting ( 'filestorage.js' , 'routes.js' , - 1 ) ,
36
+ testSorting ( 'unknown.js' , 'sandbox.js' , 1 ) ,
37
+ testSorting ( 'log.js' , 'sandbox.js' , 1 ) ,
38
+ testSorting ( 'sandbox.js' , 'sandbox.js' , 0 ) ,
39
+ testSorting ( 'log.js' , 'log.js' , 0 ) ,
40
+ testSorting ( 'tasks.js' , 'application.js' , - 1 ) ,
41
+ testSorting ( 'files.js' , 'sandbox.js' , 1 ) ,
36
42
] ,
37
43
'common.sortCompareDirectories' : [
38
44
[ { name : '/abc' } , { name : 'abc.ext' } , - 1 ] ,
0 commit comments