Create tests for app/Models/ScoringGuide
This commit is contained in:
parent
b9f6bf5917
commit
bcbbf92457
|
|
@ -0,0 +1,24 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use App\Models\Audition;
|
||||||
|
use App\Models\ScoringGuide;
|
||||||
|
use App\Models\SubscoreDefinition;
|
||||||
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||||
|
|
||||||
|
uses(RefreshDatabase::class);
|
||||||
|
|
||||||
|
beforeEach(function () {
|
||||||
|
$this->sg = ScoringGuide::factory()->create();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('can return its auditions', function () {
|
||||||
|
Audition::factory()->count(3)->create(['scoring_guide_id' => $this->sg->id]);
|
||||||
|
Audition::factory()->count(3)->create(['scoring_guide_id' => null]);
|
||||||
|
expect($this->sg->auditions()->count())->toEqual(3)
|
||||||
|
->and($this->sg->auditions()->first())->toBeInstanceOf(Audition::class);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('can return its subscore definitions', function () {
|
||||||
|
expect($this->sg->subscores()->count())->toEqual(5)
|
||||||
|
->and($this->sg->subscores()->first())->toBeInstanceOf(SubscoreDefinition::class);
|
||||||
|
});
|
||||||
Loading…
Reference in New Issue