Add tests for gifv embeds

pull/926/head^2
Tyrrrz 2 years ago
parent da87f3c774
commit f376028d76

@ -55,7 +55,7 @@ public class EmbedSpecs : IClassFixture<ExportWrapperFixture>
.QuerySelectorAll("img") .QuerySelectorAll("img")
.Select(e => e.GetAttribute("src")) .Select(e => e.GetAttribute("src"))
.Should() .Should()
.Contain("https://i.redd.it/f8w05ja8s4e61.png"); .EndWith("i.redd.it/f8w05ja8s4e61.png");
} }
[Fact] [Fact]
@ -74,6 +74,37 @@ public class EmbedSpecs : IClassFixture<ExportWrapperFixture>
content.Should().BeNullOrEmpty(); content.Should().BeNullOrEmpty();
} }
[Fact]
public async Task Message_containing_a_gifv_link_is_rendered_with_a_video_embed()
{
// Act
var message = await _exportWrapper.GetMessageAsHtmlAsync(
ChannelIds.EmbedTestCases,
Snowflake.Parse("1019234520349814794")
);
// Assert
message
.QuerySelectorAll("source")
.Select(e => e.GetAttribute("src"))
.Should()
.EndWith("media.tenor.com/DDAJeW6BQKkAAAPo/tooncasm-test-copy.mp4");
}
[Fact]
public async Task Message_containing_a_gifv_link_and_nothing_else_is_rendered_without_text_content()
{
// Act
var message = await _exportWrapper.GetMessageAsHtmlAsync(
ChannelIds.EmbedTestCases,
Snowflake.Parse("1019234520349814794")
);
// Assert
var content = message.QuerySelector(".chatlog__content")?.Text();
content.Should().BeNullOrEmpty();
}
[Fact] [Fact]
public async Task Message_containing_a_Spotify_track_link_is_rendered_with_a_track_embed() public async Task Message_containing_a_Spotify_track_link_is_rendered_with_a_track_embed()
{ {

Loading…
Cancel
Save