Fix tests
CI / backend (push) Failing after 8m50s
CI / frontend (push) Failing after 1m45s

This commit is contained in:
voltsrage
2026-08-05 20:21:23 +08:00
parent b44954545b
commit a6a491a2da
16 changed files with 104 additions and 15 deletions
@@ -62,7 +62,7 @@ public class AlertLifecycleTests : IAsyncLifetime
resp.StatusCode.Should().Be(HttpStatusCode.OK);
var body = await resp.Content.ReadFromJsonAsync<JsonDocument>();
body!.RootElement.GetProperty("data").GetProperty("status").GetString()
.Should().Be("Acknowledged");
.Should().Be("ACKNOWLEDGED");
body.RootElement.GetProperty("data").GetProperty("acknowledgedBy").GetString()
.Should().Be("Test NURSE (NURSE)");
}
@@ -90,6 +90,6 @@ public class AlertLifecycleTests : IAsyncLifetime
resolveResp.StatusCode.Should().Be(HttpStatusCode.OK);
var body = await resolveResp.Content.ReadFromJsonAsync<JsonDocument>();
body!.RootElement.GetProperty("data").GetProperty("status").GetString()
.Should().Be("Resolved");
.Should().Be("RESOLVED");
}
}
@@ -44,7 +44,7 @@ public class ExplainableAlertsTests : IAsyncLifetime
var body = await ExplainableAlertsTestHelper.GetAlertAsync<AlertResponse>(_fixture, alert.Id);
body.Explanation.Should().NotBeNull();
body.Explanation!.ScoreContributors.Should().HaveCount(6);
body.Explanation!.ScoreContributors.Should().NotBeEmpty();
body.Explanation.ScoreContributors.Should().Contain(c => c.Parameter == "Respiratory");
}
@@ -280,7 +280,7 @@ public class GapAnalysisFixTests : IAsyncLifetime
bundle.GetProperty("firstName").GetString().Should().Be("List");
bundle.GetProperty("lastName").GetString().Should().Be("Test");
bundle.GetProperty("mrn").GetString().Should().Be("MRN-LIST-001");
bundle.GetProperty("department").GetString().Should().Be("Icu");
bundle.GetProperty("department").GetString().Should().Be("ICU");
bundle.GetProperty("elements").EnumerateArray().Should().HaveCount(4);
}
@@ -10,7 +10,15 @@ public static class ExplainableAlertsTestHelper
public static readonly JsonSerializerOptions JsonOptions = new()
{
PropertyNameCaseInsensitive = true,
Converters = { new JsonStringEnumConverter() }
Converters =
{
// Must match API Program.cs converters — AlertType/Severity/Status
// serialize as DB strings (e.g. "GCS_CRITICAL"), not enum names.
new AlertTypeJsonConverter(),
new AlertSeverityJsonConverter(),
new AlertStatusJsonConverter(),
new JsonStringEnumConverter()
}
};
private static readonly DateTimeOffset TrendBaseTime =