Add validation test

This commit is contained in:
Marcus Moore 2024-08-05 15:50:09 -07:00
parent 4ed3347f52
commit 5ecdb7e07c
No known key found for this signature in database

View file

@ -3,6 +3,7 @@
namespace Tests\Feature\Users\Ui;
use App\Models\Accessory;
use App\Models\Asset;
use App\Models\Consumable;
use App\Models\Statuslabel;
use App\Models\User;
@ -23,6 +24,31 @@ class BulkDeleteUsersTest extends TestCase
->assertForbidden();
}
public function testValidation()
{
// $this->markTestIncomplete();
$user = User::factory()->create();
Asset::factory()->assignedToUser($user)->create();
$actor = $this->actingAs(User::factory()->editUsers()->create());
// "ids" required
$actor->post(route('users/bulksave'), [
// 'ids' => [
// $user->id,
// ],
'status_id' => Statuslabel::factory()->create()->id,
])->assertSessionHas('error')->assertRedirect();
// "status_id" needed when provided users have assets associated
$actor->post(route('users/bulksave'), [
'ids' => [
$user->id,
],
// 'status_id' => Statuslabel::factory()->create()->id,
])->assertSessionHas('error')->assertRedirect();
}
public function testAccessoryCheckinsAreProperlyLogged()
{
[$accessoryA, $accessoryB] = Accessory::factory()->count(2)->create();