Files
pricebuddy/tests/Unit/Dto/AiExtractionResultDtoTest.php
Jeremy 8c67d51ced feat: multi-provider AI settings and provider foundation
Introduce the AI provider layer: laravel/ai SDK integration, AiService
and AiExtractionService, the AiProvider enum (OpenAI, Gemini, Ollama)
and supporting DTOs/agents.

- Encrypt stored API keys; per-provider test-connection action
- Ollama model dropdown with reachability-based connection test
- Multi-provider settings UI with per-row test and auto-migration of
  the legacy single-provider shape into the multi-provider structure
- Resolve active config through AiProviderConfigDto
2026-06-09 15:07:40 +10:00

33 lines
949 B
PHP

<?php
use App\Dto\AiExtractionResultDto;
use App\Enums\StockStatus;
it('holds extraction fields with sensible defaults', function () {
$dto = new AiExtractionResultDto(
title: 'Widget',
price: 12.99,
currency: 'USD',
image: 'https://example.com/w.jpg',
stockStatus: StockStatus::InStock,
confidence: 0.8,
);
expect($dto->title)->toBe('Widget')
->and($dto->price)->toBe(12.99)
->and($dto->currency)->toBe('USD')
->and($dto->image)->toBe('https://example.com/w.jpg')
->and($dto->stockStatus)->toBe(StockStatus::InStock)
->and($dto->confidence)->toBe(0.8);
});
it('defaults every field', function () {
$dto = new AiExtractionResultDto;
expect($dto->title)->toBeNull()
->and($dto->price)->toBeNull()
->and($dto->image)->toBeNull()
->and($dto->stockStatus)->toBeNull()
->and($dto->confidence)->toBe(0.0);
});