mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2026-04-30 09:42:40 +00:00
Some more tests
This commit is contained in:
@@ -7,28 +7,16 @@ using Xunit;
|
||||
|
||||
namespace DiscordChatExporter.Cli.Tests.Specs.JsonWriting
|
||||
{
|
||||
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.ExportAsJsonAsync(ChannelIds.DateRangeTestCases);
|
||||
|
||||
var messageIds = document
|
||||
.GetProperty("messages")
|
||||
.EnumerateArray()
|
||||
.Select(j => j.GetProperty("id").GetString())
|
||||
.ToArray();
|
||||
|
||||
var messageTexts = document
|
||||
.GetProperty("messages")
|
||||
.EnumerateArray()
|
||||
.Select(j => j.GetProperty("content").GetString())
|
||||
.ToArray();
|
||||
var messages = await ExportWrapper.GetMessagesAsJsonAsync(ChannelIds.DateRangeTestCases);
|
||||
|
||||
// Assert
|
||||
messageIds.Should().Equal(
|
||||
messages.Select(j => j.GetProperty("id").GetString()).Should().Equal(
|
||||
"866674314627121232",
|
||||
"866710679758045195",
|
||||
"866732113319428096",
|
||||
@@ -39,7 +27,7 @@ namespace DiscordChatExporter.Cli.Tests.Specs.JsonWriting
|
||||
"885169254029213696"
|
||||
);
|
||||
|
||||
messageTexts.Should().Equal(
|
||||
messages.Select(j => j.GetProperty("content").GetString()).Should().Equal(
|
||||
"Hello world",
|
||||
"Goodbye world",
|
||||
"Foo bar",
|
||||
Reference in New Issue
Block a user