Skip to content

Commit

Permalink
Apply fixes from StyleCI
Browse files Browse the repository at this point in the history
  • Loading branch information
StyleCIBot committed Dec 1, 2024
1 parent 6a1572b commit 5d173b4
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
use Hyde\Facades\Config;
use Hyde\Markdown\Models\Markdown;
use Illuminate\Support\Str;
use League\CommonMark\Environment\Environment;
use League\CommonMark\Extension\CommonMark\CommonMarkCoreExtension;
use League\CommonMark\Extension\HeadingPermalink\HeadingPermalinkExtension;

class GeneratesTableOfContents
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function testCanGenerateTableOfContents()
{
$markdown = "# Level 1\n## Level 2\n## Level 2B\n### Level 3\n";
$result = (new GeneratesTableOfContents($markdown))->execute();

$this->assertSame([
[
'title' => 'Level 2',
Expand Down Expand Up @@ -50,9 +50,9 @@ public function testReturnStringContainsExpectedContent()
## Level 2
### Level 3
MARKDOWN;

$result = (new GeneratesTableOfContents($markdown))->execute();

$this->assertSame([
[
'title' => 'Level 2',
Expand Down Expand Up @@ -153,9 +153,9 @@ public function testWithNoLevelOneHeading()
## Level 2
### Level 3
MARKDOWN;

$result = (new GeneratesTableOfContents($markdown))->execute();

$this->assertSame([
[
'title' => 'Level 2',
Expand Down Expand Up @@ -187,9 +187,9 @@ public function testWithMultipleNestedHeadings()
## Level 2C
### Level 3D
MARKDOWN;

$result = (new GeneratesTableOfContents($markdown))->execute();

$this->assertSame([
[
'title' => 'Level 2',
Expand Down Expand Up @@ -248,9 +248,9 @@ public function testWithMultipleLevelOneHeadings()
## Level 2B
### Level 3B
MARKDOWN;

$result = (new GeneratesTableOfContents($markdown))->execute();

$this->assertSame([
[
'title' => 'Level 2',
Expand Down Expand Up @@ -299,9 +299,9 @@ public function testRespectsMinHeadingLevelConfig()
### Level 3
#### Level 4
MARKDOWN;

$result = (new GeneratesTableOfContents($markdown))->execute();

$this->assertSame([
[
'title' => 'Level 3',
Expand Down Expand Up @@ -329,9 +329,9 @@ public function testRespectsMaxHeadingLevelConfig()
### Level 3
#### Level 4
MARKDOWN;

$result = (new GeneratesTableOfContents($markdown))->execute();

$this->assertSame([
[
'title' => 'Level 2',
Expand All @@ -355,9 +355,9 @@ public function testRespectsMinAndMaxHeadingLevelConfig()
#### Level 4
##### Level 5
MARKDOWN;

$result = (new GeneratesTableOfContents($markdown))->execute();

$this->assertSame([
[
'title' => 'Level 2',
Expand Down Expand Up @@ -437,7 +437,7 @@ public function testHandlesInvalidConfigLevels()
'docs.sidebar.table_of_contents.min_heading_level' => -1,
'docs.sidebar.table_of_contents.max_heading_level' => -2,
]);

$markdown = "## Level 2\n### Level 3";
$this->assertSame([], (new GeneratesTableOfContents($markdown))->execute());

Expand All @@ -446,15 +446,15 @@ public function testHandlesInvalidConfigLevels()
'docs.sidebar.table_of_contents.min_heading_level' => 7,
'docs.sidebar.table_of_contents.max_heading_level' => 8,
]);

$this->assertSame([], (new GeneratesTableOfContents($markdown))->execute());

// Test swapped levels (min > max)
self::mockConfig([
'docs.sidebar.table_of_contents.min_heading_level' => 4,
'docs.sidebar.table_of_contents.max_heading_level' => 2,
]);

$this->assertSame([], (new GeneratesTableOfContents($markdown))->execute());
}

Expand All @@ -477,15 +477,15 @@ public function testSetextHeadersWithDifferentConfigLevels()

$this->assertSame([
[
"title" => "Level 1",
"slug" => "level-1",
"children" => [
'title' => 'Level 1',
'slug' => 'level-1',
'children' => [
[
"title" => "Level 2",
"slug" => "level-2",
"children" => [],
]
]
'title' => 'Level 2',
'slug' => 'level-2',
'children' => [],
],
],
],
], $result);

Expand Down

0 comments on commit 5d173b4

Please sign in to comment.