refactor(cli): share runtime status color rendering

This commit is contained in:
Peter Steinberger
2026-02-18 23:08:35 +00:00
parent 9a100d520d
commit 3ce615ff06
4 changed files with 38 additions and 21 deletions

View File

@@ -0,0 +1,16 @@
import { describe, expect, it } from "vitest";
import { theme } from "../../terminal/theme.js";
import { resolveRuntimeStatusColor } from "./shared.js";
describe("resolveRuntimeStatusColor", () => {
it("maps known runtime states to expected theme colors", () => {
expect(resolveRuntimeStatusColor("running")).toBe(theme.success);
expect(resolveRuntimeStatusColor("stopped")).toBe(theme.error);
expect(resolveRuntimeStatusColor("unknown")).toBe(theme.muted);
});
it("falls back to warning color for unexpected states", () => {
expect(resolveRuntimeStatusColor("degraded")).toBe(theme.warn);
expect(resolveRuntimeStatusColor(undefined)).toBe(theme.muted);
});
});