import { render } from '@react-email/render'; import { Markdown } from './markdown.js'; describe(' component renders correctly', () => { it('renders the markdown in the correct format for browsers', async () => { const actualOutput = await render( {`# Markdown Test Document This is a **test document** to check the capabilities of a Markdown parser. ## Headings ### Third-Level Heading #### Fourth-Level Heading ##### Fifth-Level Heading ###### Sixth-Level Heading ## Text Formatting This is some **bold text** and this is some *italic text*. You can also use ~~strikethrough~~ and \`inline code\`. ## Lists 1. Ordered List Item 1 2. Ordered List Item 2 3. Ordered List Item 3 - Unordered List Item 1 - Unordered List Item 2 - Unordered List Item 3 ## Links [Markdown Guide](https://www.markdownguide.org) ## Images ![Markdown Logo](https://markdown-here.com/img/icon256.png) ## Blockquotes > This is a blockquote. > - Author ## Code Blocks \`\`\`javascript function greet(name) { console.log(\`Hello, $\{name}!\`); } \`\`\``} , ); expect(actualOutput).toMatchInlineSnapshot(` "

Markdown Test Document

This is a test document to check the capabilities of a Markdown parser.

Headings

Third-Level Heading

Fourth-Level Heading

Fifth-Level Heading
Sixth-Level Heading

Text Formatting

This is some bold text and this is some italic text. You can also use strikethrough and inline code.

Lists

  1. Ordered List Item 1
  2. Ordered List Item 2
  3. Ordered List Item 3

Links

Markdown Guide

Images

Markdown Logo

Blockquotes

This is a blockquote.

  • Author

Code Blocks

function greet(name) {
      console.log(\`Hello, \${name}!\`);
      }
      
" `); }); it('renders the headers in the correct format for browsers', async () => { const actualOutput = await render( {` # Heading 1! ## Heading 2! ### Heading 3! #### Heading 4! ##### Heading 5! ###### Heading 6! `} , ); expect(actualOutput).toMatchInlineSnapshot( `"

Heading 1!

Heading 2!

Heading 3!

Heading 4!

Heading 5!
Heading 6!
"`, ); }); it('renders text in the correct format for browsers', async () => { const actualOutput = await render( **This is sample bold text in markdown** and *this is italic text* , ); expect(actualOutput).toMatchInlineSnapshot(` "

This is sample bold text in markdown and this is italic text

" `); }); it('renders links in the correct format for browsers', async () => { const actualOutput = await render( Link to [React-email](https://react.email), ); expect(actualOutput).toMatchInlineSnapshot(` "

Link to React-email

" `); }); it('renders lists in the correct format for browsers', async () => { const actualOutput = await render( {` # Below is a list - Item One - Item Two - Item Three `} , ); expect(actualOutput).toMatchInlineSnapshot(` "

Below is a list

" `); }); it('renders loose lists with paragraph continuations without crashing', async () => { const actualOutput = await render( {`- item1 paragraph continuation - item2`} , ); expect(actualOutput).toMatchInlineSnapshot(` "
" `); }); it('renders nested lists in the correct format for browsers', async () => { const actualOutput = await render( {` - parent list item - nested list item 1 - nested list item 2 - another parent item 1. nested ordered item 1 2. nested ordered item 2 `} , ); expect(actualOutput).toMatchInlineSnapshot(` "
" `); }); });