fix(ui): surface merge-drain cancel rejection in task-row quick cancel
TasksIslandViewModel.CancelReviewAsync swallowed the HubException the
worker raises when a task's unit merge is draining (79f90a9), unlike
the details-pane version fixed in the same commit. Mirror that fix:
report the rejection via ErrorReported instead of a bare catch.
This commit is contained in:
@@ -63,4 +63,28 @@ public class TasksIslandApproveReviewTests : IDisposable
|
||||
Assert.NotNull(reportedError);
|
||||
Assert.Contains(worker.ExceptionMessage, reportedError);
|
||||
}
|
||||
|
||||
private sealed class ThrowingCancelWorkerClient : StubWorkerClient
|
||||
{
|
||||
public string ExceptionMessage { get; init; } =
|
||||
"A merge is in progress for this task; wait for it to finish before cancelling.";
|
||||
public override Task CancelReviewAsync(string taskId) => throw new Exception(ExceptionMessage);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task CancelReview_WhenWorkerThrows_RaisesErrorReported()
|
||||
{
|
||||
var worker = new ThrowingCancelWorkerClient();
|
||||
var factory = new TestDbFactory(NewContext);
|
||||
var vm = new TasksIslandViewModel(factory, worker);
|
||||
|
||||
string? reportedError = null;
|
||||
vm.ErrorReported += msg => reportedError = msg;
|
||||
|
||||
var row = new TaskRowViewModel { Id = "task-cancel-err-2", Status = TaskStatus.WaitingForReview };
|
||||
await vm.CancelReviewCommand.ExecuteAsync(row);
|
||||
|
||||
Assert.NotNull(reportedError);
|
||||
Assert.Contains(worker.ExceptionMessage, reportedError);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user