Files
pricebuddy/tests/Unit/Services/AutoCreateStoreBuildAttributesTest.php
Jeremy 8b02abb0aa feat: AI self-healing store config
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
2026-06-09 15:07:40 +10:00

25 lines
987 B
PHP

<?php
namespace Tests\Unit\Services;
use App\Services\AutoCreateStore;
use Tests\TestCase;
class AutoCreateStoreBuildAttributesTest extends TestCase
{
public function test_builds_store_attributes_from_url_and_strategy(): void
{
$strategy = ['title' => ['type' => 'selector', 'value' => '.t']];
$attrs = AutoCreateStore::buildAttributes('https://www.shop.test/product/123', $strategy);
$this->assertSame([['domain' => 'shop.test'], ['domain' => 'www.shop.test']], $attrs['domains']);
$this->assertSame('Shop.test', $attrs['name']);
$this->assertSame($strategy, $attrs['scrape_strategy']);
$this->assertSame('https://www.shop.test/product/123', $attrs['settings']['test_url']);
$this->assertSame('http', $attrs['settings']['scraper_service']);
$this->assertArrayHasKey('locale', $attrs['settings']['locale_settings']);
$this->assertArrayHasKey('currency', $attrs['settings']['locale_settings']);
}
}