mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2026-02-14 15:53:30 -07:00
Simplify YouTube embed test to focus on data not structure
- Remove checks for HTML structure (class names, nested elements) - Focus on verifying YouTube URL with correct video ID exists - Follow same pattern as other embed tests (Spotify, Twitch) Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
This commit is contained in:
parent
b9865dce8c
commit
58504e2b8d
|
|
@ -181,24 +181,15 @@ public class HtmlEmbedSpecs
|
||||||
);
|
);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
var youtubeLink = message
|
var youtubeUrl = message
|
||||||
.QuerySelectorAll("a")
|
.QuerySelectorAll("a")
|
||||||
.FirstOrDefault(e =>
|
.Select(e => e.GetAttribute("href"))
|
||||||
e.GetAttribute("href")?.Contains("youtube.com/watch?v=", StringComparison.Ordinal)
|
.WhereNotNull()
|
||||||
== true
|
.FirstOrDefault(s =>
|
||||||
|
s.Contains("youtube.com/watch?v=qOWW4OlgbvE", StringComparison.Ordinal)
|
||||||
);
|
);
|
||||||
|
|
||||||
youtubeLink.Should().NotBeNull();
|
youtubeUrl.Should().NotBeNull();
|
||||||
youtubeLink?.GetAttribute("href").Should().Contain("qOWW4OlgbvE");
|
|
||||||
|
|
||||||
// Check that the thumbnail image exists
|
|
||||||
var thumbnail = youtubeLink
|
|
||||||
?.QuerySelectorAll("img")
|
|
||||||
.FirstOrDefault(e =>
|
|
||||||
e.GetAttribute("class")?.Contains("chatlog__embed-youtube-thumbnail") == true
|
|
||||||
);
|
|
||||||
|
|
||||||
thumbnail.Should().NotBeNull();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue