56 - Cover the refresh-csrf route with feature tests

This commit is contained in:
myrmidex 2026-08-20 22:10:32 +02:00
parent c1d8008b5d
commit b543f5fdb3

View file

@ -91,6 +91,24 @@ public function test_users_can_logout(): void
$this->assertGuest(); $this->assertGuest();
} }
public function test_refresh_csrf_returns_the_current_token_to_a_guest(): void
{
$response = $this->getJson('/refresh-csrf');
$response->assertStatus(200);
$response->assertJson(['token' => csrf_token()]);
}
public function test_refresh_csrf_returns_the_current_token_to_an_authenticated_user(): void
{
$user = Planner::factory()->create();
$response = $this->actingAs($user)->getJson('/refresh-csrf');
$response->assertStatus(200);
$response->assertJson(['token' => csrf_token()]);
}
public function test_logout_invalidates_the_session(): void public function test_logout_invalidates_the_session(): void
{ {
$user = Planner::factory()->create(); $user = Planner::factory()->create();