<?php

namespace Tests\Unit\Services\ClassSections;

use App\Services\ClassSections\ClassSectionSeedService;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\DB;
use Tests\TestCase;

class ClassSectionSeedServiceTest extends TestCase
{
    use RefreshDatabase;

    public function test_seed_defaults_creates_rows(): void
    {
        DB::table('configuration')->insert([
            ['config_key' => 'school_year', 'config_value' => '2025-2026'],
            ['config_key' => 'semester', 'config_value' => 'Fall'],
        ]);

        $service = app(ClassSectionSeedService::class);
        $count = $service->seedDefaults();

        $this->assertGreaterThan(0, $count);
        $this->assertDatabaseHas('classes', [
            'class_name' => 'Class 1',
            'semester' => 'Fall',
            'school_year' => '2025-2026',
        ]);
    }
}
