From 68a7ef16de1c960f859967864a804134bd7c0be8 Mon Sep 17 00:00:00 2001 From: Garv Sanveria Date: Sun, 27 Sep 2026 17:23:51 +0530 Subject: [PATCH 1/2] test: cover TableOfContentMarkdown component --- .../components/TableOfContentMarkdown.cy.tsx | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 cypress/components/TableOfContentMarkdown.cy.tsx diff --git a/cypress/components/TableOfContentMarkdown.cy.tsx b/cypress/components/TableOfContentMarkdown.cy.tsx new file mode 100644 index 000000000..1802e21e6 --- /dev/null +++ b/cypress/components/TableOfContentMarkdown.cy.tsx @@ -0,0 +1,27 @@ +import React from 'react'; +import { TableOfContentMarkdown } from '../../components/TableOfContentMarkdown'; + +describe('TableOfContentMarkdown Component', () => { + it('renders h1 as a link with generated slug', () => { + cy.mount(); + cy.get('a').should('have.attr', 'href', '#hello-world'); + cy.get('a').should('contain', 'Hello World'); + }); + + it('renders h2 with bullet point', () => { + cy.mount(); + cy.get('a').should('have.attr', 'href', '#section-title'); + cy.get('a').should('contain', 'Section Title'); + }); + + it('ignores h3 when depth is 2', () => { + cy.mount(); + cy.get('a').should('not.exist'); + }); + + it('renders h3 when depth is 3', () => { + cy.mount(); + cy.get('a').should('have.attr', 'href', '#sub-section'); + cy.get('a').should('contain', 'Sub Section'); + }); +}); From 951aa7fdd7a568209d0ef71272d67863d5fcaa77 Mon Sep 17 00:00:00 2001 From: Garv Sanveria Date: Wed, 30 Sep 2026 23:35:01 +0530 Subject: [PATCH 2/2] style: fix double quotes --- cypress/components/TableOfContentMarkdown.cy.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cypress/components/TableOfContentMarkdown.cy.tsx b/cypress/components/TableOfContentMarkdown.cy.tsx index 1802e21e6..5c33ca0ee 100644 --- a/cypress/components/TableOfContentMarkdown.cy.tsx +++ b/cypress/components/TableOfContentMarkdown.cy.tsx @@ -3,24 +3,24 @@ import { TableOfContentMarkdown } from '../../components/TableOfContentMarkdown' describe('TableOfContentMarkdown Component', () => { it('renders h1 as a link with generated slug', () => { - cy.mount(); + cy.mount(); cy.get('a').should('have.attr', 'href', '#hello-world'); cy.get('a').should('contain', 'Hello World'); }); it('renders h2 with bullet point', () => { - cy.mount(); + cy.mount(); cy.get('a').should('have.attr', 'href', '#section-title'); cy.get('a').should('contain', 'Section Title'); }); it('ignores h3 when depth is 2', () => { - cy.mount(); + cy.mount(); cy.get('a').should('not.exist'); }); it('renders h3 when depth is 3', () => { - cy.mount(); + cy.mount(); cy.get('a').should('have.attr', 'href', '#sub-section'); cy.get('a').should('contain', 'Sub Section'); });