fix(felis): 启动失败的服可在面板重试或停止,玩家入服时直接告知启动失败

This commit is contained in:
Lemon-miaow committed 2026-09-26 22:08:29 +08:00
1 parent c1025274e1
commit 22d1e834ad
28 files changed
+775 -75

No files matched your search

+13 -1
View File
@@ -1,5 +1,5 @@
import { describe, it, expect } from "vitest";
import { PHASE_COLOR, phaseColor, phaseVariant } from "@/components/PhaseBadge";
import { PHASE_COLOR, phaseColor, phaseVariant, startFailure } from "@/components/PhaseBadge";
import type { Phase } from "@/lib/types";
// The closed lifecycle set felis-api can emit — the Go source of truth is
@@ -47,3 +47,15 @@ describe("unmodelled phase fallback", () => {
expect(phaseVariant(future)).toBe(phaseVariant("Unknown"));
});
});
describe("start failure", () => {
// A Failed phase only reads as a failed start while the server still wants to
// run; a stopped Failed server needs nothing from its owner.
it("reads a failed start only while the server wants to run", () => {
expect(startFailure({ phase: "Running", desiredState: "Running" })).toBeNull();
expect(startFailure({ phase: "Failed", desiredState: "Stopped" })).toBeNull();
expect(startFailure({ phase: "Failed" })).toBeNull();
expect(startFailure({ phase: "Failed", desiredState: "Running" })).toBe("retrying");
expect(startFailure({ phase: "Failed", desiredState: "Running", startGaveUp: true })).toBe("gaveUp");
});
});