Skip to content

Commit

Permalink
Update sitemap tests and add rss feed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
caendesilva committed May 19, 2022
1 parent 5f1b137 commit fe93f5b
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion tests/Feature/Commands/BuildStaticSiteCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,37 @@ public function test_sitemap_is_generated_when_conditions_are_met()

unlinkIfExists(Hyde::path('_site/sitemap.xml'));
$this->artisan('build')
->expectsOutput('Generating sitemap.xml')
->expectsOutput('Generating sitemap...')
->assertExitCode(0);

$this->assertFileExists(Hyde::path('_site/sitemap.xml'));
unlink(Hyde::path('_site/sitemap.xml'));
}

public function test_rss_feed_is_not_generated_when_conditions_are_not_met()
{
config(['hyde.site_url' => '']);
config(['hyde.generateRssFeed' => false]);

unlinkIfExists(Hyde::path('_site/feed.rss'));
$this->artisan('build')
->assertExitCode(0);

$this->assertFileDoesNotExist(Hyde::path('_site/feed.rss'));
}

public function test_rss_feed_is_generated_when_conditions_are_met()
{
config(['hyde.site_url' => 'https://example.com']);
config(['hyde.generateRssFeed' => true]);

unlinkIfExists(Hyde::path('_site/feed.rss'));
$this->artisan('build')
->expectsOutput('Generating RSS feed...')
->assertExitCode(0);

$this->assertFileExists(Hyde::path('_site/feed.rss'));
unlink(Hyde::path('_site/feed.rss'));
}

/**
Expand Down

0 comments on commit fe93f5b

Please sign in to comment.