feat: add comprehensive tests for Medium, OtpCode, Shift models and various Enums
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\Models;
|
||||
|
||||
use App\Models\Shift;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class ShiftTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_active_scope_returns_only_active_shifts(): void
|
||||
{
|
||||
$active = Shift::factory()->create();
|
||||
Shift::factory()->inactive()->create();
|
||||
|
||||
$this->assertSame([$active->id], Shift::active()->pluck('id')->all());
|
||||
}
|
||||
|
||||
public function test_open_scope_returns_only_unassigned_shifts(): void
|
||||
{
|
||||
$open = Shift::factory()->create();
|
||||
Shift::factory()->forDoctor()->create();
|
||||
|
||||
$this->assertSame([$open->id], Shift::open()->pluck('id')->all());
|
||||
}
|
||||
|
||||
public function test_scopes_can_be_chained(): void
|
||||
{
|
||||
$target = Shift::factory()->create();
|
||||
Shift::factory()->inactive()->create();
|
||||
Shift::factory()->forDoctor()->create();
|
||||
Shift::factory()->forDoctor()->inactive()->create();
|
||||
|
||||
$this->assertSame([$target->id], Shift::active()->open()->pluck('id')->all());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user