@@ -12,6 +12,7 @@ describe('MarkdownIndexGenerator', () => {
1212 it ( 'should show the generated menu' , async ( ) => {
1313 await MarkdownIndexGenerator ( './test/__mocks__/test.md' ) ;
1414 expect ( console . log ) . toHaveBeenCalledWith ( '--- Begin MarkDown ---' ) ;
15+ expect ( console . log ) . toHaveBeenCalledWith ( expect . stringContaining ( 'Index' ) ) ;
1516 expect ( console . log ) . toHaveBeenCalledWith ( expect . stringContaining ( '[Heading 2](#heading-2)' ) ) ;
1617 expect ( console . log ) . toHaveBeenCalledWith ( expect . stringContaining ( '- [Sub sub heading 4](#sub-sub-heading-4)' ) ) ;
1718 expect ( console . log ) . toHaveBeenCalledWith ( '--- End Markdown ---' ) ;
@@ -24,4 +25,13 @@ describe('MarkdownIndexGenerator', () => {
2425 expect ( console . log ) . toHaveBeenCalledWith ( expect . not . stringContaining ( '- [Sub sub heading 4](#sub-sub-heading-4)' ) ) ;
2526 expect ( console . log ) . toHaveBeenCalledWith ( '--- End Markdown ---' ) ;
2627 } ) ;
28+
29+ it ( 'should show the generated menu, and contain a custom title' , async ( ) => {
30+ await MarkdownIndexGenerator ( './test/__mocks__/test.md' , { title : 'test' , depth : 2 , replace : false } ) ;
31+ expect ( console . log ) . toHaveBeenCalledWith ( '--- Begin MarkDown ---' ) ;
32+ expect ( console . log ) . toHaveBeenCalledWith ( expect . not . stringContaining ( 'Index' ) ) ;
33+ expect ( console . log ) . toHaveBeenCalledWith ( expect . stringContaining ( '[Heading 2](#heading-2)' ) ) ;
34+ expect ( console . log ) . toHaveBeenCalledWith ( expect . not . stringContaining ( '- [Sub sub heading 4](#sub-sub-heading-4)' ) ) ;
35+ expect ( console . log ) . toHaveBeenCalledWith ( '--- End Markdown ---' ) ;
36+ } ) ;
2737} ) ;
0 commit comments