mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2026-04-28 00:36:00 +00:00
Some more tests
This commit is contained in:
@@ -8,26 +8,16 @@ using Xunit;
|
||||
|
||||
namespace DiscordChatExporter.Cli.Tests.Specs.HtmlWriting
|
||||
{
|
||||
public record GeneralSpecs(ExportWrapperFixture ExportWrapper) : IClassFixture<ExportWrapperFixture>
|
||||
public record ContentSpecs(ExportWrapperFixture ExportWrapper) : IClassFixture<ExportWrapperFixture>
|
||||
{
|
||||
[Fact]
|
||||
public async Task Messages_are_exported_correctly()
|
||||
{
|
||||
// Act
|
||||
var document = await ExportWrapper.ExportAsHtmlAsync(ChannelIds.DateRangeTestCases);
|
||||
|
||||
var messageIds = document
|
||||
.QuerySelectorAll(".chatlog__message")
|
||||
.Select(e => e.GetAttribute("data-message-id"))
|
||||
.ToArray();
|
||||
|
||||
var messageTexts = document
|
||||
.QuerySelectorAll(".chatlog__content")
|
||||
.Select(e => e.Text().Trim())
|
||||
.ToArray();
|
||||
var messages = await ExportWrapper.GetMessagesAsHtmlAsync(ChannelIds.DateRangeTestCases);
|
||||
|
||||
// Assert
|
||||
messageIds.Should().Equal(
|
||||
messages.Select(e => e.GetAttribute("data-message-id")).Should().Equal(
|
||||
"866674314627121232",
|
||||
"866710679758045195",
|
||||
"866732113319428096",
|
||||
@@ -38,7 +28,7 @@ namespace DiscordChatExporter.Cli.Tests.Specs.HtmlWriting
|
||||
"885169254029213696"
|
||||
);
|
||||
|
||||
messageTexts.Should().Equal(
|
||||
messages.Select(e => e.QuerySelector(".chatlog__content")?.Text().Trim()).Should().Equal(
|
||||
"Hello world",
|
||||
"Goodbye world",
|
||||
"Foo bar",
|
||||
Reference in New Issue
Block a user