Write tests - Write tests for what was done to this point that will be kept #11

Merged
okorpheus merged 61 commits from write-tests into master 2024-07-05 21:21:32 +00:00
1 changed files with 28 additions and 0 deletions
Showing only changes of commit 0cf4727aac - Show all commits

View File

@ -0,0 +1,28 @@
<?php
use App\Models\Entry;
use App\Models\JudgeAdvancementVote;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
uses(RefreshDatabase::class);
beforeEach(function () {
$this->judge = User::factory()->create();
$this->entry = Entry::factory()->create();
$this->vote = JudgeAdvancementVote::create([
'user_id' => $this->judge->id,
'entry_id' => $this->entry->id,
'vote' => 'pass',
]);
});
test('has a judge', function () {
expect($this->vote->judge)->toBeInstanceOf(User::class)
->and($this->vote->judge->first_name)->toBe($this->judge->first_name);
});
test('has an entry', function () {
expect($this->vote->entry)->toBeInstanceOf(Entry::class)
->and($this->vote->entry->student->first_name)->toBe($this->entry->student->first_name);
});