<?php

it('restricts absolute webhook URLs to configured n8n webhook host', function (): void {
    $classFile = app_path('classes/n8n.php');
    $content = file_get_contents($classFile);

    expect($content)->not->toBeFalse();
    expect($content)->toContain('isAllowedWebhookAbsoluteUrl');
    expect($content)->toContain('Webhook URL must use the configured n8n webhook host.');
    expect($content)->toContain('$targetHost !== $baseHost');
    expect($content)->toContain('$targetScheme !== $baseScheme');
    expect($content)->toContain('return $targetPort === $basePort;');
});
