<?php

declare(strict_types=1);

use App\Http\Requests\Manage\ManageArtworkUpdateRequest;
use Illuminate\Support\Facades\Validator;

it('rejects raw html in the legacy manage artwork update request', function (): void {
    $request = ManageArtworkUpdateRequest::create('/manage/123', 'POST', [
        'title' => 'Legacy Manage Artwork',
        'description' => '<img src="https://spam.example/test.jpg" alt="">',
    ]);

    $validator = Validator::make($request->all(), $request->rules());
    $request->withValidator($validator);

    expect($validator->fails())->toBeTrue()
        ->and($validator->errors()->has('description'))->toBeTrue();
});