diff --git a/dotcom-rendering/src/model/enhanceTableOfContents.test.ts b/dotcom-rendering/src/model/enhanceTableOfContents.test.ts index 2b0a65f7725..4129f34630d 100644 --- a/dotcom-rendering/src/model/enhanceTableOfContents.test.ts +++ b/dotcom-rendering/src/model/enhanceTableOfContents.test.ts @@ -60,20 +60,15 @@ describe('Enhance Table of Contents', () => { ]); }); - it('will not return a toc if the are fewer than 3 h2s', () => { + it('will not return a toc if there are no h2s', () => { const input: Block[] = [ { ...blockMetaData, elements: [ { - _type: 'model.dotcomrendering.pageElements.SubheadingBlockElement', - elementId: 'h2One', - html: '

This is the h2 text

', - }, - { - _type: 'model.dotcomrendering.pageElements.SubheadingBlockElement', - elementId: 'h2Two', - html: '

This is the h2 text

', + _type: 'model.dotcomrendering.pageElements.TextBlockElement', + elementId: 'text', + html: 'Text', }, ], }, diff --git a/dotcom-rendering/src/model/enhanceTableOfContents.ts b/dotcom-rendering/src/model/enhanceTableOfContents.ts index a864ffe89ac..24b6b13446b 100644 --- a/dotcom-rendering/src/model/enhanceTableOfContents.ts +++ b/dotcom-rendering/src/model/enhanceTableOfContents.ts @@ -112,5 +112,5 @@ export const enhanceTableOfContents = ( } } - return tocItems.length >= 3 ? tocItems : undefined; + return tocItems.length >= 1 ? tocItems : undefined; };