test(ai): cover config-provider default fallback when no profile row
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using ROLAC.API.Data;
|
||||
using ROLAC.API.Services.Ai;
|
||||
using Xunit;
|
||||
|
||||
namespace ROLAC.API.Tests.Services;
|
||||
|
||||
public class ChurchAiConfigProviderTests
|
||||
{
|
||||
private static AppDbContext NewDb() =>
|
||||
new AppDbContext(new DbContextOptionsBuilder<AppDbContext>()
|
||||
.UseInMemoryDatabase(Guid.NewGuid().ToString()).Options);
|
||||
|
||||
[Fact]
|
||||
public async Task GetAsync_returns_defaults_when_no_profile_row()
|
||||
{
|
||||
using var db = NewDb(); // empty DB, no ChurchProfile
|
||||
|
||||
var cfg = await new ChurchAiConfigProvider(db).GetAsync();
|
||||
|
||||
Assert.Equal("Claude", cfg.Provider);
|
||||
Assert.Equal("claude-haiku-4-5-20251001", cfg.ClaudeModel);
|
||||
Assert.Equal("gemini-2.5-flash-lite", cfg.GeminiModel);
|
||||
Assert.Null(cfg.ClaudeApiKey);
|
||||
Assert.Null(cfg.GeminiApiKey);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user