Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions tests/FiscalApi.Cli.Tests/Listen/ListenCommandTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -338,10 +338,16 @@ public async Task A_409_on_the_ack_is_reported_only_with_verbose(bool verbose)

StartListen(verbose ? ["--verbose"] : []);
await ExpectAsync(_api.WaitForAcksAsync(2));
var diagnostic = $"Could not acknowledge delivery dlv_0001: {notAwaiting}";
if (verbose)
{
await WaitForErrorAsync(diagnostic);
}

Assert.Equal(verbose, Error.Contains($"Could not acknowledge delivery dlv_0001: {notAwaiting}"));
Assert.Equal(2, _api.Acks.Count);
Assert.False(_run!.IsCompleted, "listen terminó por un acuse tardío.");
Assert.Equal(ExitCodes.Cancelled, await PressCtrlCAsync());
Assert.Equal(verbose, Error.Contains(diagnostic));
}

[Fact]
Expand All @@ -355,7 +361,7 @@ public async Task Another_rejected_ack_is_reported_and_listen_goes_on()
await ExpectAsync(_api.WaitForAcksAsync(2));
await ExpectAsync(_api.WaitForPollsAsync(3));

Assert.Contains("Could not acknowledge delivery dlv_0001: No se encontró el recurso dlv_0001.", Error);
await WaitForErrorAsync("Could not acknowledge delivery dlv_0001: No se encontró el recurso dlv_0001.");
Assert.False(_run!.IsCompleted, "listen terminó por un acuse rechazado.");
}

Expand Down Expand Up @@ -800,6 +806,9 @@ public async Task Invalid_options_are_usage_errors_without_calling_the_api(strin
private static string EventLine(string type, string eventId, string suffix) =>
$@"(?m)^\d{{4}}-\d{{2}}-\d{{2}} \d{{2}}:\d{{2}}:\d{{2}} {Regex.Escape(type)} \[{Regex.Escape(eventId)}\]{Regex.Escape(suffix)}\r?$";

private Task WaitForErrorAsync(string line) =>
ExpectAsync(FakeListenerApi.WaitUntilAsync(() => Error.Contains(line, StringComparison.Ordinal), $"No llegó a stderr: {line}"));

private async Task ExpectAsync(Task condition)
{
try
Expand Down
Loading