Files
ai-web/tests/Unit/ModelScoringServiceTest.php

37 lines
773 B
PHP
Raw Normal View History

2026-02-11 17:28:36 +08:00
<?php
declare(strict_types=1);
namespace Tests\Unit;
use App\Models\AiModel;
use App\Services\ModelScoringService;
use Tests\TestCase;
class ModelScoringServiceTest extends TestCase
{
public function test_it_calculates_weighted_score(): void
{
$service = new ModelScoringService();
$score = $service->calculateTotal(90, 70, 80);
$this->assertSame(82, $score);
}
public function test_it_bounds_scores_when_apply_called(): void
{
$service = new ModelScoringService();
$model = new AiModel([
'effectiveness_score' => 120,
'price_score' => -10,
'speed_score' => 80,
]);
$service->apply($model);
$this->assertSame(66, $model->total_score);
}
}