fix(overview): expose each health check state in text
This commit is contained in:
@@ -49,6 +49,35 @@ public class InstanceCardTests : BunitContext
|
||||
.Add(c => c.Now, Now)
|
||||
.Add(c => c.IsLeader, isLeader));
|
||||
|
||||
[Theory]
|
||||
[InlineData("Healthy", "Healthy", "ok")]
|
||||
[InlineData("Degraded", "Degraded", "warn")]
|
||||
[InlineData("Unhealthy", "Unhealthy", "bad")]
|
||||
[InlineData(null, "Unknown", "idle")]
|
||||
[InlineData("FutureState", "Unknown", "idle")]
|
||||
[InlineData("", "Unknown", "idle")]
|
||||
public void CheckRow_ExposesItsStatusWithoutInferringDescription(
|
||||
string? status, string label, string stateClass)
|
||||
{
|
||||
var report = new ZbHealthReport
|
||||
{
|
||||
Status = "Degraded",
|
||||
Entries = new Dictionary<string, ZbHealthEntry>
|
||||
{
|
||||
["database"] = new() { Status = status, Description = "remote <description>" },
|
||||
},
|
||||
};
|
||||
var cut = Render(Card(report: report));
|
||||
var row = cut.Find(".check-row");
|
||||
var state = row.QuerySelector(".check-state");
|
||||
Assert.NotNull(state);
|
||||
Assert.Equal(label, state.TextContent);
|
||||
Assert.Contains($"s-{stateClass}", state.ClassList);
|
||||
Assert.Equal("true", row.QuerySelector(".check-dot")!.GetAttribute("aria-hidden"));
|
||||
Assert.Equal("remote <description>", row.QuerySelector(".check-desc")!.TextContent);
|
||||
Assert.Empty(row.QuerySelectorAll("description"));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(InstanceStatus.Up, "up", "Up")]
|
||||
[InlineData(InstanceStatus.Degraded, "degraded", "Degraded")]
|
||||
|
||||
Reference in New Issue
Block a user