<?php

declare(strict_types=1);

use App\Models\Deal;
use Illuminate\Database\QueryException;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Illuminate\Support\Facades\Schema;
use Tests\Concerns\SharesSupplierPdo;

uses(DatabaseTransactions::class, SharesSupplierPdo::class);

it('deals has nullable subject_code column', function (): void {
    expect(Schema::hasColumn('deals', 'subject_code'))->toBeTrue();
});

it('rejects subject_code out of 1..89 range', function (): void {
    expect(fn () => Deal::factory()->create(['subject_code' => 90]))
        ->toThrow(QueryException::class);
});
