Files
GmRelayBot/tests/GmRelay.Bot.Tests/Web/HomePageSourceTests.cs
T
Toutsu c2cc7fd9a8
Deploy Telegram Bot / build-and-push (push) Successful in 5m46s
Deploy Telegram Bot / scan-images (push) Successful in 3m29s
Deploy Telegram Bot / deploy (push) Successful in 29s
fix(web): show discord sessions and integration labels
2026-05-26 14:43:33 +03:00

36 lines
1.4 KiB
C#

namespace GmRelay.Bot.Tests.Web;
public sealed class HomePageSourceTests
{
[Fact]
public async Task HomePage_ShouldShowPlatformBadgeForGroups()
{
var source = await ReadRepositoryFileAsync("src/GmRelay.Web/Components/Pages/Home.razor");
Assert.Contains("platform-badge", source, StringComparison.Ordinal);
Assert.Contains("FormatPlatform", source, StringComparison.Ordinal);
Assert.Contains("group.Platform", source, StringComparison.Ordinal);
}
[Fact]
public async Task SessionService_ShouldUseSessionTitleWhenDiscordGroupNameIsOnlyId()
{
var source = await ReadRepositoryFileAsync("src/GmRelay.Web/Services/SessionService.cs");
Assert.Contains("latest_session.title", source, StringComparison.Ordinal);
Assert.Contains("NULLIF(g.name, g.external_group_id)", source, StringComparison.Ordinal);
}
private static async Task<string> ReadRepositoryFileAsync(string relativePath)
{
var dir = AppContext.BaseDirectory;
while (!string.IsNullOrEmpty(dir) && !File.Exists(Path.Combine(dir, "Directory.Build.props")))
{
dir = Directory.GetParent(dir)?.FullName;
}
var repoRoot = dir ?? throw new InvalidOperationException("Could not find repo root");
return await File.ReadAllTextAsync(Path.Combine(repoRoot, relativePath));
}
}