From b9ab2d79f3535bab174467092bc951e61997fda4 Mon Sep 17 00:00:00 2001 From: Timothy Date: Fri, 17 Jul 2026 20:31:09 +0200 Subject: [PATCH] test(385): cover override-driven per-channel failure isolation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds the one coverage case the cold review flagged (LOW): a two-channel batch where the first channel's advanced override is rejected downstream and the second, override-free channel is still Created — directly exercising the partial-success / batch-independence guarantee for the new override path. Test-only; no behavior change. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../CreateAutoTunedChannelsHandlerTests.cs | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/ErsatzTV.Tests/Application/Channels/CreateAutoTunedChannelsHandlerTests.cs b/ErsatzTV.Tests/Application/Channels/CreateAutoTunedChannelsHandlerTests.cs index 25ee56858..855bb876e 100644 --- a/ErsatzTV.Tests/Application/Channels/CreateAutoTunedChannelsHandlerTests.cs +++ b/ErsatzTV.Tests/Application/Channels/CreateAutoTunedChannelsHandlerTests.cs @@ -160,6 +160,40 @@ public class CreateAutoTunedChannelsHandlerTests Arg.Any()); } + [Test] + public async Task A_Bad_Per_Channel_Override_Fails_Only_That_Channel_Not_The_Batch() + { + // First channel's override is rejected downstream (e.g. a non-existent FFmpegProfileId); + // the second, override-free channel must still be Created. Keyed on channel number so the + // two CreateChannelFromLineup sends resolve to different outcomes. + _mediator.Send( + Arg.Is(c => c.Number == "500"), + Arg.Any()) + .Returns((Either) + BaseError.New("FFmpegProfile 999 does not exist.")); + _mediator.Send( + Arg.Is(c => c.Number == "501"), + Arg.Any()) + .Returns((Either) + new CreateChannelFromLineupResponseModel(88, null, 1, 2)); + + var result = await Handle(new CreateAutoTunedChannels( + TemplateId: 3, Group: "Auto-Tuned", + new List + { + new( + AutoTuneAxis.TvGenre, "Comedy", "Bad", "500", + Advanced: new CreateChannelFromLineupAdvancedOptions(FFmpegProfileId: 999)), + new(AutoTuneAxis.TvGenre, "Drama", "Good", "501") + })); + + result.FailedCount.ShouldBe(1); + result.CreatedCount.ShouldBe(1); + result.Results[0].Status.ShouldBe(AutoTuneOutcomeStatus.Failed); + result.Results[1].Status.ShouldBe(AutoTuneOutcomeStatus.Created); + result.Results[1].ChannelId.ShouldBe(88); + } + [Test] public async Task Number_Collision_Is_Skipped_Not_Failed() {