From 58504e2b8d88de273bf6ebad93c4a75b4f22dd78 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 12 Feb 2026 11:21:57 +0000 Subject: [PATCH] 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> --- .../Specs/HtmlEmbedSpecs.cs | 21 ++++++------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/DiscordChatExporter.Cli.Tests/Specs/HtmlEmbedSpecs.cs b/DiscordChatExporter.Cli.Tests/Specs/HtmlEmbedSpecs.cs index c8ce5183..0a406a4b 100644 --- a/DiscordChatExporter.Cli.Tests/Specs/HtmlEmbedSpecs.cs +++ b/DiscordChatExporter.Cli.Tests/Specs/HtmlEmbedSpecs.cs @@ -181,24 +181,15 @@ public class HtmlEmbedSpecs ); // Assert - var youtubeLink = message + var youtubeUrl = message .QuerySelectorAll("a") - .FirstOrDefault(e => - e.GetAttribute("href")?.Contains("youtube.com/watch?v=", StringComparison.Ordinal) - == true + .Select(e => e.GetAttribute("href")) + .WhereNotNull() + .FirstOrDefault(s => + s.Contains("youtube.com/watch?v=qOWW4OlgbvE", StringComparison.Ordinal) ); - youtubeLink.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(); + youtubeUrl.Should().NotBeNull(); } [Fact]