Files
GmRelayBot/tests/GmRelay.Bot.Tests/Web/GroupDetailsSourceTests.cs
Toutsu fac5d75c7e
Deploy Telegram Bot / build-and-push (push) Successful in 5m58s
Deploy Telegram Bot / scan-images (push) Successful in 3m39s
Deploy Telegram Bot / deploy (push) Successful in 34s
Fix Discord co-GM management
2026-05-27 16:32:47 +03:00

36 lines
1.5 KiB
C#

namespace GmRelay.Bot.Tests.Web;
public sealed class GroupDetailsSourceTests
{
[Fact]
public async Task GroupDetails_ShouldManageCoGmUsingGroupPlatform()
{
var source = await ReadRepositoryFileAsync("src/GmRelay.Web/Components/Pages/GroupDetails.razor");
Assert.Contains("CoGmPlatform", source, StringComparison.Ordinal);
Assert.Contains("@CoGmIdLabel", source, StringComparison.Ordinal);
Assert.Contains("coGmModel.ExternalUserId", source, StringComparison.Ordinal);
Assert.Matches(@"SessionService\.AddCoGmForOwnerAsync\(\s*GroupId,\s*CoGmPlatform,\s*coGmExternalUserId", source);
Assert.Matches(@"SessionService\.RemoveCoGmForOwnerAsync\(GroupId,\s*platform,\s*coGmExternalUserId\)", source);
Assert.DoesNotContain("Telegram ID co-GM", source, StringComparison.Ordinal);
Assert.DoesNotContain("SessionService.RemoveCoGmForOwnerAsync(GroupId, \"Telegram\"", source, StringComparison.Ordinal);
}
private static async Task<string> ReadRepositoryFileAsync(string relativePath)
{
var directory = new DirectoryInfo(AppContext.BaseDirectory);
while (directory is not null)
{
var candidate = Path.Combine(directory.FullName, relativePath);
if (File.Exists(candidate))
{
return await File.ReadAllTextAsync(candidate);
}
directory = directory.Parent;
}
throw new FileNotFoundException($"Could not locate repository file '{relativePath}'.");
}
}