<?php

use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;

uses(RefreshDatabase::class);

it('prevents unverified users from logging in', function () {
    $user = User::factory()->unverified()->create([
        'password' => 'password',
    ]);

    $response = $this->postJson('/api/auth/login', [
        'email' => $user->email,
        'password' => 'password',
    ]);

    $response
        ->assertUnprocessable()
        ->assertJsonValidationErrors([
            'email' => __('auth.email_not_verified'),
        ]);
});
