using System.Text.RegularExpressions;
namespace Volcanic.AgenticCore.Telegram.Tests;
/// Values the repo-root docker-compose.yml copies from the host's code.
public sealed class DockerComposeTests
{
[Fact]
public void Compose_model_fallback_matches_TelegramOptions_DefaultModel()
{
var compose = File.ReadAllText(RepoFile("docker-compose.yml"));
var matches = Regex.Matches(compose, @"Telegram__Model=\$\{TELEGRAM_MODEL:-(?[^}]+)\}");
var match = Assert.Single(matches);
Assert.Equal(TelegramOptions.DefaultModel, match.Groups["model"].Value);
}
/// A file in the repository root, found by walking up from the test output to VolcanicAgenticCore.slnx.
private static string RepoFile(string name)
{
for (var dir = new DirectoryInfo(AppContext.BaseDirectory); dir is not null; dir = dir.Parent)
{
if (File.Exists(Path.Combine(dir.FullName, "VolcanicAgenticCore.slnx"))) return Path.Combine(dir.FullName, name);
}
throw new InvalidOperationException("VolcanicAgenticCore.slnx not found above " + AppContext.BaseDirectory);
}
}