Skip to content

Commit

Permalink
Improve Markdown document testing
Browse files Browse the repository at this point in the history
  • Loading branch information
caendesilva committed Jul 30, 2024
1 parent 51b604a commit aa76b40
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions packages/framework/tests/Unit/MarkdownDocumentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,30 @@ public function testCarriageReturnsAreNormalized()
$markdown = new Markdown("foo\nbar");
$this->assertSame("foo\nbar", $markdown->body());
}

public function testRender(): void
{
$html = Markdown::render('# Hello World!');

$this->assertIsString($html);
$this->assertSame("<h1>Hello World!</h1>\n", $html);
}

public function testRenderWithCustomHydeMarkdownFeatures()
{
$html = Markdown::render(<<<'MARKDOWN'
# Hello World
>info Colored blockquote
[Home](/_pages/index.blade.php)
MARKDOWN);

$this->assertSame(<<<'HTML'
<h1>Hello World</h1>
<blockquote class="info"><p>Colored blockquote</p></blockquote>
<p><a href="index.html">Home</a></p>

HTML, $html);
}
}

0 comments on commit aa76b40

Please sign in to comment.