<?php

use Database\Seeders\DatabaseSeeder;
use Illuminate\Support\Facades\Auth;

it('can run the database seeder twice without duplicate user errors', function () {
    $this->seed(DatabaseSeeder::class);
    $this->seed(DatabaseSeeder::class);

    $user = \App\Models\User::query()->where('email', 'test@example.com')->first();

    expect($user)->not->toBeNull();
    expect($user->email)->toBe('test@example.com');

    expect(Auth::attempt(['email' => 'test@example.com', 'password' => 'password']))->toBeTrue();
});
