Add test for storing user

This commit is contained in:
Marcus Moore 2025-03-05 11:37:03 -08:00
parent 69009e027f
commit 25395e9af1
No known key found for this signature in database

View file

@ -57,4 +57,22 @@ class StoreUsersTest extends TestCase
$json->has('messages.department_id')->etc(); $json->has('messages.department_id')->etc();
}); });
} }
public function testCanStoreUser()
{
$this->actingAsForApi(User::factory()->createUsers()->create())
->postJson(route('api.users.store'), [
'first_name' => 'Darth',
'username' => 'darthvader',
'password' => 'darth_password',
'password_confirmation' => 'darth_password',
])
->assertStatusMessageIs('success')
->assertOk();
$this->assertDatabaseHas('users', [
'first_name' => 'Darth',
'username' => 'darthvader',
]);
}
} }