Create tests for app/Models/SchoolEmailDomain

This commit is contained in:
Matt Young 2025-07-03 16:14:53 -05:00
parent 08fd7a215a
commit 9b8584777e
1 changed files with 17 additions and 0 deletions

View File

@ -0,0 +1,17 @@
<?php
use App\Models\School;
use App\Models\SchoolEmailDomain;
use Illuminate\Foundation\Testing\RefreshDatabase;
uses(RefreshDatabase::class);
beforeEach(function () {
$this->school = School::factory()->create();
$this->school->emailDomains()->create(['domain' => 'test.com']);
});
it('returns its school', function () {
expect(SchoolEmailDomain::first()->school->id)->toEqual($this->school->id)
->and(SchoolEmailDomain::first()->school)->toBeInstanceOf(School::class);
});