Make tests more resilient

This commit is contained in:
Tyrrrz
2023-09-28 19:18:52 +03:00
parent c466c17793
commit fbfff4e51f
5 changed files with 32 additions and 15 deletions

View File

@@ -1,4 +1,5 @@
using System.Linq;
using System;
using System.Linq;
using System.Threading.Tasks;
using AngleSharp.Dom;
using DiscordChatExporter.Cli.Tests.Infra;
@@ -27,7 +28,11 @@ public class HtmlAttachmentSpecs
.Select(e => e.GetAttribute("href"))
.Should()
.Contain(
"https://cdn.discordapp.com/attachments/885587741654536192/885587844964417596/Test.txt"
u =>
u.StartsWith(
"https://cdn.discordapp.com/attachments/885587741654536192/885587844964417596/Test.txt",
StringComparison.Ordinal
)
);
}
@@ -48,7 +53,11 @@ public class HtmlAttachmentSpecs
.Select(e => e.GetAttribute("src"))
.Should()
.Contain(
"https://cdn.discordapp.com/attachments/885587741654536192/885654862430359613/bird-thumbnail.png"
u =>
u.StartsWith(
"https://cdn.discordapp.com/attachments/885587741654536192/885654862430359613/bird-thumbnail.png",
StringComparison.Ordinal
)
);
}
@@ -69,7 +78,7 @@ public class HtmlAttachmentSpecs
var videoUrl = message.QuerySelector("video source")?.GetAttribute("src");
videoUrl
.Should()
.Be(
.StartWith(
"https://cdn.discordapp.com/attachments/885587741654536192/885655761512968233/file_example_MP4_640_3MG.mp4"
);
}
@@ -91,7 +100,7 @@ public class HtmlAttachmentSpecs
var audioUrl = message.QuerySelector("audio source")?.GetAttribute("src");
audioUrl
.Should()
.Be(
.StartWith(
"https://cdn.discordapp.com/attachments/885587741654536192/885656175348187146/file_example_MP3_1MG.mp3"
);
}