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();