@@ -7,10 +7,10 @@ var Plugin = rewire('../lib/plugin');
77var h = rewire ( '../lib/helper' ) ;
88
99describe ( 'plugin' , function ( ) {
10- var cache = new Plugin ( 'cache' , 'Cache ' , '1 .0' , '' ) ;
11- var leetcode = new Plugin ( 'leetcode' , 'Leetcode ' , '2 .0' , '' ) ;
12- var retry = new Plugin ( 'retry' , 'Retry' , '3.0' , '' ) ;
13- var core = new Plugin ( 'core' , 'Core' , '4.0' , '' ) ;
10+ var leetcode = new Plugin ( 0 , 'Leetcode ' , '2 .0' , '' ) ;
11+ var cache = new Plugin ( 1 , 'Cache ' , '1 .0' , '' ) ;
12+ var retry = new Plugin ( 2 , 'Retry' , '3.0' , '' ) ;
13+ var core = new Plugin ( 3 , 'Core' , '4.0' , '' ) ;
1414
1515 before ( function ( ) {
1616 log . init ( ) ;
@@ -26,17 +26,21 @@ describe('plugin', function() {
2626 { name : 'cache' , data : cache } ,
2727 { name : 'leetcode' , data : leetcode } ,
2828 { name : 'retry' , data : retry } ,
29- { name : 'core' , data : core } ,
3029 { name : 'bad' , data : null }
3130 ] ;
3231 } ;
3332 Plugin . __set__ ( 'h' , h ) ;
3433 } ) ;
3534
3635 it ( 'should init ok' , function ( ) {
37- assert . deepEqual ( _ . keys ( Plugin . plugins ) , [ ] ) ;
36+ assert . deepEqual ( Plugin . plugins , [ ] ) ;
3837 Plugin . init ( core ) ;
39- assert . deepEqual ( _ . keys ( Plugin . plugins ) , [ 'cache' , 'leetcode' , 'retry' , 'core' ] ) ;
38+ assert . deepEqual ( Plugin . plugins . length , 3 ) ;
39+
40+ var names = Plugin . plugins . map ( function ( p ) {
41+ return p . name ;
42+ } ) ;
43+ assert . deepEqual ( names , [ 'Retry' , 'Cache' , 'Leetcode' ] ) ;
4044
4145 assert . equal ( core . next , retry ) ;
4246 assert . equal ( retry . next , cache ) ;
0 commit comments