<?php

namespace Tests\Unit\Services\School;

use App\Services\School\SemesterSelectionService;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\DB;
use Tests\TestCase;

class SemesterSelectionServiceTest extends TestCase
{
    use RefreshDatabase;

    public function test_selected_teacher_semester_prefers_session_value(): void
    {
        $service = new SemesterSelectionService();

        $this->assertSame('Fall', $service->selectedTeacherSemester());
    }

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

        $service = new SemesterSelectionService();

        $this->assertSame('Fall', $service->selectedTeacherSemester());
    }
}
