feat(users): enforce active email uniqueness per role

This commit is contained in:
2026-09-04 14:17:37 -03:00
parent 75152b53a4
commit a35ff69140
10 changed files with 217 additions and 9 deletions

View File

@@ -60,6 +60,17 @@ class AdministratorControllerTest extends TestCase
return ['nombre_apellido' => 'Ada Lovelace', 'dni' => '12345678', 'email' => 'ada@example.test'];
}
public function test_email_can_be_shared_with_customers_and_scanners(): void
{
Sanctum::actingAs($this->admin);
foreach (['user', 'scanner'] as $role) {
User::factory()->create(['email' => 'ada@example.test', 'rol_codigo' => $role]);
}
$response = $this->postJson(self::URL, $this->payload())->assertCreated();
$this->putJson(self::URL.'/'.$response->json('data.id'), $this->payload())->assertOk();
$this->postJson(self::URL, $this->payload())->assertUnprocessable()->assertJsonValidationErrors('email');
}
public function test_crud_and_password_setup_and_token_revocation(): void
{
Sanctum::actingAs($this->admin);