Files
pricebuddy/tests/Unit/Enums/AiProviderTest.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

26 lines
998 B
PHP

<?php
use App\Enums\AiProvider;
use Laravel\Ai\Enums\Lab;
it('has the expected string value for every case', function () {
expect(AiProvider::OpenAI->value)->toBe('openai')
->and(AiProvider::Anthropic->value)->toBe('anthropic')
->and(AiProvider::Ollama->value)->toBe('ollama')
->and(AiProvider::Gemini->value)->toBe('gemini');
});
it('maps each provider to the matching SDK lab', function () {
expect(AiProvider::OpenAI->toLab())->toBe(Lab::OpenAI)
->and(AiProvider::Anthropic->toLab())->toBe(Lab::Anthropic)
->and(AiProvider::Ollama->toLab())->toBe(Lab::Ollama)
->and(AiProvider::Gemini->toLab())->toBe(Lab::Gemini);
});
it('exposes the config driver key for each provider', function () {
expect(AiProvider::OpenAI->driver())->toBe('openai')
->and(AiProvider::Anthropic->driver())->toBe('anthropic')
->and(AiProvider::Ollama->driver())->toBe('ollama')
->and(AiProvider::Gemini->driver())->toBe('gemini');
});