@@ -74,7 +74,9 @@ Content here.
7474 expect ( result . filesModified ) . toBe ( 1 ) ;
7575
7676 const modifiedContent = await readFile ( filePath , 'utf-8' ) ;
77- expect ( modifiedContent ) . toMatch ( / ^ # # # C o n t e n t s \n \n .* - \[ M a i n T i t l e \] \( # m a i n - t i t l e \) .* - \[ S e c t i o n 1 \] \( # s e c t i o n - 1 \) .* # M a i n T i t l e / s) ;
77+ expect ( modifiedContent ) . toMatch (
78+ / ^ # # # C o n t e n t s \n \n .* - \[ M a i n T i t l e \] \( # m a i n - t i t l e \) .* - \[ S e c t i o n 1 \] \( # s e c t i o n - 1 \) .* # M a i n T i t l e / s
79+ ) ;
7880 } ) ;
7981
8082 it ( 'should handle position "before-content"' , async ( ) => {
@@ -129,7 +131,9 @@ Content here.
129131
130132 const modifiedContent = await readFile ( filePath , 'utf-8' ) ;
131133 expect ( modifiedContent ) . not . toContain ( 'Old TOC content' ) ;
132- expect ( modifiedContent ) . toContain ( '<!-- TOC -->\n## Table of Contents\n\n- [Main Title](#main-title)\n - [Section 1](#section-1)\n<!-- TOC -->' ) ;
134+ expect ( modifiedContent ) . toContain (
135+ '<!-- TOC -->\n## Table of Contents\n\n- [Main Title](#main-title)\n - [Section 1](#section-1)\n<!-- TOC -->'
136+ ) ;
133137 } ) ;
134138
135139 it ( 'should handle position "replace" with auto-detection' , async ( ) => {
@@ -239,7 +243,7 @@ Content here.
239243 // The original content should still contain the deep subsection
240244 // but it should not appear in the TOC
241245 expect ( modifiedContent ) . toContain ( '#### Deep subsection' ) ;
242-
246+
243247 // Check that the TOC doesn't contain the deep subsection as a link
244248 const tocSection = modifiedContent . substring (
245249 modifiedContent . indexOf ( '## Table of Contents' ) ,
@@ -347,7 +351,9 @@ Content here.
347351 expect ( result . filesModified ) . toBe ( 1 ) ;
348352
349353 const modifiedContent = await readFile ( filePath , 'utf-8' ) ;
350- expect ( modifiedContent ) . toContain ( '#### Document Contents\n\n- [Main Title](#main-title)\n - [Section 1](#section-1)' ) ;
354+ expect ( modifiedContent ) . toContain (
355+ '#### Document Contents\n\n- [Main Title](#main-title)\n - [Section 1](#section-1)'
356+ ) ;
351357 } ) ;
352358 } ) ;
353359
@@ -394,17 +400,19 @@ Content here.
394400 const filePath = join ( tempDir , 'test.md' ) ;
395401 await writeFile ( filePath , '# Test' , 'utf-8' ) ;
396402
397- await expect ( tocCommand ( [ filePath ] , {
398- position : 'invalid-position' ,
399- minDepth : 1 ,
400- maxDepth : 6 ,
401- includeLineNumbers : false ,
402- title : 'Table of Contents' ,
403- headingLevel : 2 ,
404- skipEmpty : true ,
405- dryRun : false ,
406- verbose : false ,
407- } ) ) . rejects . toThrow ( 'Invalid position: invalid-position' ) ;
403+ await expect (
404+ tocCommand ( [ filePath ] , {
405+ position : 'invalid-position' ,
406+ minDepth : 1 ,
407+ maxDepth : 6 ,
408+ includeLineNumbers : false ,
409+ title : 'Table of Contents' ,
410+ headingLevel : 2 ,
411+ skipEmpty : true ,
412+ dryRun : false ,
413+ verbose : false ,
414+ } )
415+ ) . rejects . toThrow ( 'Invalid position: invalid-position' ) ;
408416 } ) ;
409417
410418 it ( 'should output JSON when requested' , async ( ) => {
@@ -440,4 +448,4 @@ Content here.
440448 consoleSpy . mockRestore ( ) ;
441449 } ) ;
442450 } ) ;
443- } ) ;
451+ } ) ;
0 commit comments