TASK 5 items 1-3: reusable stream, health banner, docs refresh
- Reusable stream: GetOrCreateReusableStreamAsync, cached via LayoutStore, bound at broadcast insert - Health monitoring: GetStreamHealthAsync polls liveStreams.status, report-by-exception banner - Go-live order: ensure stream → create broadcast → then start pump (URL must exist first) - Full broadcast form scoped (TASK 5 items 6-7) in TASKS.md + ai.md - TASK 23 trimmed to technical scope, TASK 26 added (marcom/launch kit) - Confidential files: MONETIZATION.md + MARCOM.md (gitignored, not committed) - .gitignore updated for confidential business files - HANDOFF.md updated with session state and next steps
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
using Xunit;
|
||||
using ytLive.Models;
|
||||
using ytLive.Services;
|
||||
|
||||
namespace ytLive.Tests;
|
||||
|
||||
/// <summary>
|
||||
/// Report-by-exception (TASK 5 item 3): the banner decision is pure so the
|
||||
/// severity/threshold rules are pinned without any HTTP or UI.
|
||||
/// </summary>
|
||||
public class StreamHealthReporterTests
|
||||
{
|
||||
[Fact]
|
||||
public void Banner_Is_Null_For_Empty_Or_Info_Only_Issues()
|
||||
{
|
||||
Assert.Null(StreamHealthReporter.BannerFor([]).Text);
|
||||
|
||||
var report = StreamHealthReporter.BannerFor(new[]
|
||||
{
|
||||
new StreamConfigurationIssue { Severity = StreamIssueSeverity.Info, Type = "lowLatency" },
|
||||
});
|
||||
Assert.Null(report.Text);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Warning_Yields_Text_Without_Error_Color()
|
||||
{
|
||||
var report = StreamHealthReporter.BannerFor(new[]
|
||||
{
|
||||
new StreamConfigurationIssue { Severity = StreamIssueSeverity.Warning, Type = "reconnect" },
|
||||
});
|
||||
Assert.Equal("reconnect", report.Text);
|
||||
Assert.False(report.IsError);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Error_Issue_Yields_Text_And_Error_Color_Even_With_Warnings()
|
||||
{
|
||||
var report = StreamHealthReporter.BannerFor(new[]
|
||||
{
|
||||
new StreamConfigurationIssue { Severity = StreamIssueSeverity.Warning, Type = "reconnect" },
|
||||
new StreamConfigurationIssue { Severity = StreamIssueSeverity.Error, Type = "bitrateHigh" },
|
||||
});
|
||||
Assert.Equal("reconnect, bitrateHigh", report.Text);
|
||||
Assert.True(report.IsError);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Blank_Issue_Types_Are_Dropped_From_The_Banner()
|
||||
{
|
||||
var report = StreamHealthReporter.BannerFor(new[]
|
||||
{
|
||||
new StreamConfigurationIssue { Severity = StreamIssueSeverity.Error, Type = null },
|
||||
new StreamConfigurationIssue { Severity = StreamIssueSeverity.Error, Type = " " },
|
||||
new StreamConfigurationIssue { Severity = StreamIssueSeverity.Error, Type = "bitrateLow" },
|
||||
});
|
||||
Assert.Equal("bitrateLow", report.Text);
|
||||
Assert.True(report.IsError);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user