39 lines
1.1 KiB
PHP
39 lines
1.1 KiB
PHP
<?php
|
|
|
|
use App\Enums\ContentType;
|
|
use App\Models\ContentRecap;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
|
|
uses(RefreshDatabase::class);
|
|
|
|
describe('ContentRecap Model', function () {
|
|
it('can create a content recap entry', function () {
|
|
$recap = ContentRecap::factory()->create([
|
|
'title' => 'Test Recap',
|
|
]);
|
|
|
|
expect($recap->title)->toBe('Test Recap')
|
|
->and($recap->exists)->toBeTrue();
|
|
});
|
|
|
|
it('has guarded attributes', function () {
|
|
$guarded = ['id'];
|
|
|
|
expect(ContentRecap::make()->getGuarded())->toEqual($guarded);
|
|
});
|
|
|
|
it('belongs to classification', function () {
|
|
$recap = ContentRecap::factory()->create();
|
|
|
|
expect($recap->classification())->toBeInstanceOf(BelongsTo::class);
|
|
});
|
|
|
|
it('casts type to content type enum', function () {
|
|
$recap = ContentRecap::factory()->create(['type' => ContentType::VIDEO]);
|
|
|
|
expect($recap->type)->toBeInstanceOf(ContentType::class)
|
|
->and($recap->type)->toBe(ContentType::VIDEO);
|
|
});
|
|
});
|