From b543f5fdb33cdb5ccb93e62adffc49832bc42666 Mon Sep 17 00:00:00 2001 From: myrmidex Date: Thu, 20 Aug 2026 22:10:32 +0200 Subject: [PATCH] 56 - Cover the refresh-csrf route with feature tests --- tests/Feature/AuthenticationTest.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/Feature/AuthenticationTest.php b/tests/Feature/AuthenticationTest.php index 03df219..92fcc79 100644 --- a/tests/Feature/AuthenticationTest.php +++ b/tests/Feature/AuthenticationTest.php @@ -91,6 +91,24 @@ public function test_users_can_logout(): void $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 { $user = Planner::factory()->create();