30 lines
1.0 KiB
PHP
30 lines
1.0 KiB
PHP
<?php
|
|
|
|
use App\Models\Audition;
|
|
use App\Models\ScoringGuide;
|
|
use App\Models\SubscoreDefinition;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
|
|
uses(RefreshDatabase::class);
|
|
|
|
it('has auditions in score order', function () {
|
|
// Arrange
|
|
$scoringGuide = ScoringGuide::factory()->create();
|
|
Audition::factory()->count(5)->create(['scoring_guide_id' => $scoringGuide->id]);
|
|
$audition = Audition::factory()->create(['scoring_guide_id' => $scoringGuide->id, 'score_order' => 0]);
|
|
|
|
// Act & Assert
|
|
expect($scoringGuide->auditions->count())->toBe(6)
|
|
->and($scoringGuide->auditions->first()->id)->toBe($audition->id)
|
|
->and($scoringGuide->auditions->first())->toBeInstanceOf(Audition::class);
|
|
});
|
|
|
|
it('has subscores', function () {
|
|
// Arrange
|
|
$sg = ScoringGuide::factory()->create();
|
|
SubscoreDefinition::factory()->count(5)->create(['scoring_guide_id' => $sg->id]);
|
|
// Act & Assert
|
|
expect($sg->subscores->count())->toBe(5)
|
|
->and($sg->subscores->first())->toBeInstanceOf(SubscoreDefinition::class);
|
|
});
|