@@ -14,31 +14,41 @@ var ROOT = join(__dirname, 'fixtures');
1414
1515var fixtures = fs . readdirSync ( ROOT ) ;
1616
17- test ( 'mdast-util-toc()' , function ( t ) {
17+ test ( 'mdast-util-toc()' , function ( t ) {
1818 t . is ( typeof toc , 'function' , 'should be a function' ) ;
1919
20- t . throws ( function ( ) {
21- toc ( ) ;
22- } , 'Cannot read property \'children\' of undefined' , 'should fail without node' ) ;
20+ t . throws (
21+ function ( ) {
22+ toc ( ) ;
23+ } ,
24+ "Cannot read property 'children' of undefined" ,
25+ 'should fail without node'
26+ ) ;
2327
2428 t . end ( ) ;
2529} ) ;
2630
27- test ( 'Fixtures' , function ( t ) {
28- fixtures . filter ( function ( filepath ) {
29- return filepath . indexOf ( '.' ) !== 0 ;
30- } ) . forEach ( function ( fixture ) {
31- var filepath = join ( ROOT , fixture ) ;
32- var output = JSON . parse ( read ( join ( filepath , 'output.json' ) , 'utf8' ) ) ;
33- var input = remark ( ) . use ( remarkAttr ) . parse ( read ( join ( filepath , 'input.md' ) , 'utf-8' ) ) ;
34- var config = join ( filepath , 'config.json' ) ;
35- var result ;
36-
37- config = exists ( config ) ? JSON . parse ( read ( config , 'utf-8' ) ) : { } ;
38- result = toc ( input , config ) ;
39-
40- t . deepEqual ( result , output , 'should work on `' + fixture + '`' ) ;
41- } ) ;
31+ test ( 'Fixtures' , function ( t ) {
32+ fixtures
33+ . filter ( function ( filepath ) {
34+ return filepath . indexOf ( '.' ) !== 0 ;
35+ } )
36+ . forEach ( function ( fixture ) {
37+ var filepath = join ( ROOT , fixture ) ;
38+ var output = JSON . parse (
39+ read ( join ( filepath , 'output.json' ) , 'utf8' )
40+ ) ;
41+ var input = remark ( )
42+ . use ( remarkAttr )
43+ . parse ( read ( join ( filepath , 'input.md' ) , 'utf-8' ) ) ;
44+ var config = join ( filepath , 'config.json' ) ;
45+ var result ;
46+
47+ config = exists ( config ) ? JSON . parse ( read ( config , 'utf-8' ) ) : { } ;
48+ result = toc ( input , config ) ;
49+
50+ t . deepEqual ( result , output , 'should work on `' + fixture + '`' ) ;
51+ } ) ;
4252
4353 t . end ( ) ;
4454} ) ;
0 commit comments