<?php

use App\Models\User;
use Database\Seeders\AdminUserSeeder;

test('admin user seeder creates an admin user with a personal team', function () {
    $this->seed(AdminUserSeeder::class);

    $admin = User::query()->where('email', config('admin.default_email'))->firstOrFail();

    expect($admin->is_admin)->toBeTrue();
    expect($admin->currentTeam)->not->toBeNull();
    expect($admin->currentTeam->is_personal)->toBeTrue();
});

test('admin user seeder is idempotent', function () {
    $this->seed(AdminUserSeeder::class);
    $this->seed(AdminUserSeeder::class);

    expect(User::query()->where('email', config('admin.default_email'))->count())->toBe(1);
});
