Render server cross-posts properly

Closes #633
This commit is contained in:
Tyrrrz
2023-02-09 18:44:24 +02:00
parent 93799eb231
commit 049338009e
22 changed files with 96 additions and 43 deletions

View File

@@ -3,12 +3,14 @@ using System.Threading.Tasks;
using AngleSharp.Dom;
using DiscordChatExporter.Cli.Tests.Fixtures;
using DiscordChatExporter.Cli.Tests.TestData;
using DiscordChatExporter.Core.Discord;
using FluentAssertions;
using Xunit;
namespace DiscordChatExporter.Cli.Tests.Specs;
public class HtmlContentSpecs : IClassFixture<ExportWrapperFixture>
[Collection(nameof(ExportWrapperCollection))]
public class HtmlContentSpecs
{
private readonly ExportWrapperFixture _exportWrapper;
@@ -46,4 +48,21 @@ public class HtmlContentSpecs : IClassFixture<ExportWrapperFixture>
"Yeet"
);
}
[Fact]
public async Task Messages_cross_posted_from_other_guilds_are_rendered_with_the_server_tag()
{
// https://github.com/Tyrrrz/DiscordChatExporter/issues/633
// Act
var message = await _exportWrapper.GetMessageAsHtmlAsync(
ChannelIds.ReplyTestCases,
Snowflake.Parse("1072165330853576876")
);
// Assert
message.Text().Should().Contain("This is a test message from an announcement channel on another server");
message.Text().Should().Contain("SERVER");
message.QuerySelector(".chatlog__reply-link").Should().BeNull();
}
}