<?php

namespace Tests\Unit\Services\Attendance;

use App\Services\Attendance\SemesterRangeService;
use PHPUnit\Framework\TestCase;

class SemesterRangeServiceTest extends TestCase
{
    public function test_normalize_semester(): void
    {
        $service = new SemesterRangeService();

        $this->assertSame('Fall', $service->normalizeSemester('fall'));
        $this->assertSame('Spring', $service->normalizeSemester('SPRING'));
        $this->assertSame('', $service->normalizeSemester('summer'));
    }

    public function test_get_school_year_range(): void
    {
        $service = new SemesterRangeService();

        [$start, $end] = $service->getSchoolYearRange('2025-2026');

        $this->assertSame('2025-09-01', $start);
        $this->assertSame('2026-05-31', $end);
    }

    public function test_build_sunday_list(): void
    {
        $service = new SemesterRangeService();

        $sundays = $service->buildSundayList('2025-09-01', '2025-09-30');

        $this->assertContains('2025-09-07', $sundays);
        $this->assertContains('2025-09-14', $sundays);
        $this->assertContains('2025-09-21', $sundays);
        $this->assertContains('2025-09-28', $sundays);
    }
}