Update tests
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Models\User;
|
||||
use Tests\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class PlaylistCreationTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_authenticated_user_can_create_playlist(): void
|
||||
{
|
||||
$user = User::factory()->create();
|
||||
|
||||
$this->actingAs($user)
|
||||
->post('/create-playlist', ['name' => 'My List', 'visiblity' => 'private'])
|
||||
->assertRedirect(route('profile.playlists'));
|
||||
|
||||
$this->assertDatabaseHas('playlists', [
|
||||
'user_id' => $user->id,
|
||||
'name' => 'My List',
|
||||
'is_private' => true,
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_playlist_requires_a_name(): void
|
||||
{
|
||||
$user = User::factory()->create();
|
||||
|
||||
$this->actingAs($user)
|
||||
->post('/create-playlist', [])
|
||||
->assertSessionHasErrors('name');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user