Skip to content

Commit 1deff38

Browse files
committed
Add output assertions
1 parent 2d29ed8 commit 1deff38

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

packages/framework/tests/Feature/Commands/BuildSitemapCommandTest.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,12 @@ public function testSitemapIsGeneratedWhenConditionsAreMet()
2121

2222
$this->assertFileDoesNotExist(Hyde::path('_site/sitemap.xml'));
2323

24-
$this->artisan('build:sitemap')->assertExitCode(0);
24+
$this->artisan('build:sitemap')
25+
->expectsOutputToContain('Generating sitemap...')
26+
->doesntExpectOutputToContain('Skipped')
27+
->expectsOutputToContain(' > Created _site/sitemap.xml')
28+
->assertExitCode(0);
29+
2530
$this->assertFileExists(Hyde::path('_site/sitemap.xml'));
2631

2732
Filesystem::unlink('_site/sitemap.xml');
@@ -33,7 +38,12 @@ public function testSitemapIsNotGeneratedWhenConditionsAreNotMet()
3338

3439
$this->assertFileDoesNotExist(Hyde::path('_site/sitemap.xml'));
3540

36-
$this->artisan('build:sitemap')->assertExitCode(0);
41+
$this->artisan('build:sitemap')
42+
->expectsOutputToContain('Generating sitemap...')
43+
->expectsOutputToContain('Skipped')
44+
->expectsOutput(' > Cannot generate sitemap without a valid base URL')
45+
->assertExitCode(0);
46+
3747
$this->assertFileDoesNotExist(Hyde::path('_site/sitemap.xml'));
3848
}
3949
}

0 commit comments

Comments
 (0)