using System.Text.RegularExpressions;
using DeepDrftPublic.Client.Helpers;
namespace DeepDrftTests;
///
/// Unit tests for the share-popover embed snippet (). The builder is
/// the mode-aware half of SharePopover: track mode targets FramePlayer's TrackEntryKey param, release
/// mode targets its ReleaseEntryKey param. The two snippets share width/border/autoplay chrome but
/// diverge in height by design (Phase 17 §4.1, OQ6): the release embed is taller to show its queue
/// panel; the track embed stays compact. Pure string composition, tested without rendering.
///
[TestFixture]
public class EmbedSnippetBuilderTests
{
private const string BaseUri = "https://deepdrft.example/";
[Test]
public void ForTrack_EmitsTrackEntryKeySrc()
{
var snippet = EmbedSnippetBuilder.ForTrack(BaseUri, "abc123");
Assert.That(snippet, Does.Contain(@"src=""https://deepdrft.example/FramePlayer?TrackEntryKey=abc123"""));
Assert.That(snippet, Does.Not.Contain("ReleaseEntryKey"));
}
[Test]
public void ForRelease_EmitsReleaseEntryKeySrc()
{
var snippet = EmbedSnippetBuilder.ForRelease(BaseUri, "rel-xyz");
// src contains ReleaseEntryKey; may also carry additional query params (e.g. EmbedId).
Assert.That(snippet, Does.Contain("ReleaseEntryKey=rel-xyz"));
Assert.That(snippet, Does.Not.Contain("TrackEntryKey"));
}
[Test]
public void BothModes_ShareIdenticalNonHeightChrome()
{
var track = EmbedSnippetBuilder.ForTrack(BaseUri, "k");
var release = EmbedSnippetBuilder.ForRelease(BaseUri, "k");
Assert.Multiple(() =>
{
foreach (var snippet in new[] { track, release })
{
Assert.That(snippet, Does.StartWith("