Skip to content

Commit

Permalink
Add unit test
Browse files Browse the repository at this point in the history
With fixtures from Laravel Framework test for the `Str::slug` helper
  • Loading branch information
caendesilva committed Dec 7, 2024
1 parent 3f48395 commit c4e9e05
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/framework/tests/Unit/HeadingRendererUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,15 @@ public function testPostProcessHandlesNoHeadingTags()
$this->assertSame('<p>Paragraph</p>', (new HeadingRenderer())->postProcess($html));
}

public function testHeadingIdentifierGeneration()
{
$this->assertSame('hello-world', HeadingRenderer::makeIdentifier('hello world'));
$this->assertSame('hello-world', HeadingRenderer::makeIdentifier('hello-world'));
$this->assertSame('hello-world', HeadingRenderer::makeIdentifier('hello_world'));
$this->assertSame('user-at-host', HeadingRenderer::makeIdentifier('user@host'));
$this->assertSame('', HeadingRenderer::makeIdentifier(''));
}

protected function mockChildNodeRenderer(string $contents = 'Test Heading'): ChildNodeRendererInterface
{
$childRenderer = Mockery::mock(ChildNodeRendererInterface::class);
Expand Down

0 comments on commit c4e9e05

Please sign in to comment.