Files
GmRelayBot/tests/GmRelay.Bot.Tests/Features/Sessions/ListSessions/SessionListMessageRendererTests.cs
T
Toutsu e0ee8fc962 fix(list-sessions): clarify manager action button labels
The /listsessions buttons for owners/co-GMs only showed emoji + date,
so it was unclear what each button did. Add explicit verb labels:
-  Отменить <date>
-  Перенести <date>
- ⬆️ С ожидания <date>
- 🗑 Удалить <date>

Update the renderer test to assert the new labels.
2026-06-15 10:56:42 +03:00

63 lines
2.2 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using GmRelay.Bot.Features.Sessions.ListSessions;
using GmRelay.Shared.Domain;
using GmRelay.Shared.Features.Sessions.ListSessions;
namespace GmRelay.Bot.Tests.Features.Sessions.ListSessions;
public sealed class SessionListMessageRendererTests
{
[Fact]
public void Render_ShouldIncludeManagerActions_WhenUserCanManage()
{
var sessionId = Guid.NewGuid();
var sessions = new[]
{
new SessionListItemDto(
sessionId,
"Ravenloft",
new DateTime(2026, 5, 7, 16, 30, 0, DateTimeKind.Utc),
SessionStatus.Planned,
4,
3,
1,
true)
};
var text = SessionListMessageRenderer.RenderText(sessions);
var actions = SessionListMessageRenderer.RenderActions(sessions);
Assert.Contains("Ravenloft", text);
Assert.Equal(4, actions.Count);
Assert.Contains(actions, a => a.Payload == $"cancel_session:{sessionId}");
Assert.Contains(actions, a => a.Payload == $"reschedule_session:{sessionId}");
Assert.Contains(actions, a => a.Payload == $"promote_waitlist:{sessionId}");
Assert.Contains(actions, a => a.Payload == $"delete_session:{sessionId}");
var shortDate = new DateTime(2026, 5, 7, 16, 30, 0, DateTimeKind.Utc).FormatMoscowShort();
Assert.Contains(actions, a => a.Label == $"❌ Отменить {shortDate}");
Assert.Contains(actions, a => a.Label == $"⏰ Перенести {shortDate}");
Assert.Contains(actions, a => a.Label == $"⬆️ С ожидания {shortDate}");
Assert.Contains(actions, a => a.Label == $"🗑 Удалить {shortDate}");
}
[Fact]
public void Render_ShouldHideManagerActions_WhenUserCannotManage()
{
var sessions = new[]
{
new SessionListItemDto(
Guid.NewGuid(),
"Ravenloft",
new DateTime(2026, 5, 7, 16, 30, 0, DateTimeKind.Utc),
SessionStatus.Planned,
4,
3,
1,
false)
};
var actions = SessionListMessageRenderer.RenderActions(sessions);
Assert.Empty(actions);
}
}