Skip to content

Commit ba78b75

Browse files
authoredJul 10, 2024··
Create CreateTeamTest.php
1 parent b5f2f24 commit ba78b75

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
use App\Models\User;
4+
use App\UserType;
5+
use Laravel\Jetstream\Http\Livewire\CreateTeamForm;
6+
use Livewire\Livewire;
7+
8+
test('teams can be created', function () {
9+
$this->actingAs($user = User::factory()->withPersonalTeam()->create(['type' => UserType::SuperAdmin]));
10+
11+
Livewire::test(CreateTeamForm::class)
12+
->set(['state' => ['name' => 'Test Team']])
13+
->call('createTeam');
14+
15+
expect($user->fresh()->ownedTeams)->toHaveCount(2);
16+
expect($user->fresh()->ownedTeams()->latest('id')->first()->name)->toEqual('Test Team');
17+
});

0 commit comments

Comments
 (0)
Please sign in to comment.