mirror of
https://github.com/jez500/pricebuddy.git
synced 2026-11-24 19:58:13 +01:00
Add AiConfigHealer to bootstrap or repair a store config via a tool-using structured agent (fetch/css/regex tools, HealingContext, shared StrategyExtractor). - Run healing before the one-shot enhancer; AI-bootstrap a store config when product create would otherwise fail; StoreUrl validation defers to self-healing when enabled - Per-feature AI provider resolution (AiFeature enum) and settings - Per-store self-healing opt-out plus cooldown; log heal attempts and unusable proposals - Heal with AI action with non-persisting preview/apply/discard in the store test modal; prompt switches to browser scraping when blocked
33 lines
943 B
PHP
33 lines
943 B
PHP
<?php
|
|
|
|
namespace Tests\Unit\Services;
|
|
|
|
use App\Services\AiConfigHealer;
|
|
use PHPUnit\Framework\TestCase;
|
|
use ReflectionClass;
|
|
|
|
class AiConfigHealerPromptTest extends TestCase
|
|
{
|
|
private function prompt(): string
|
|
{
|
|
return (string) (new ReflectionClass(AiConfigHealer::class))->getConstant('PROMPT');
|
|
}
|
|
|
|
public function test_prompt_instructs_static_first_then_browser_fallback(): void
|
|
{
|
|
$prompt = $this->prompt();
|
|
|
|
$this->assertStringContainsString('rendered=false', $prompt);
|
|
$this->assertStringContainsString('rendered=true', $prompt);
|
|
}
|
|
|
|
public function test_prompt_tells_the_agent_to_switch_to_browser_when_blocked(): void
|
|
{
|
|
$prompt = strtolower($this->prompt());
|
|
|
|
$this->assertStringContainsString('blocked', $prompt);
|
|
$this->assertStringContainsString('captcha', $prompt);
|
|
$this->assertStringContainsString('browser scraping', $prompt);
|
|
}
|
|
}
|