<?php

use App\Models\Journalist;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Foundation\Testing\RefreshDatabase;

uses(RefreshDatabase::class);

describe('Journalist Model', function () {
    it('can create a journalist', function () {
        $journalist = Journalist::factory()->create([
            'name' => 'Test Journalist',
            'email' => 'journalist@example.com',
        ]);

        expect($journalist->name)->toBe('Test Journalist')
            ->and($journalist->email)->toBe('journalist@example.com')
            ->and($journalist->exists)->toBeTrue();
    });

    it('has guarded attributes', function () {
        $guarded = ['id'];

        expect(Journalist::make()->getGuarded())->toEqual($guarded);
    });

    it('belongs to partner media', function () {
        $journalist = Journalist::factory()->create();

        expect($journalist->partnerMedia())->toBeInstanceOf(BelongsTo::class);
    });
});
