Files
browser/platform_web/contracts/serverManagement.test.ts
T

20 lines
754 B
TypeScript

import { describe, expect, it } from "vitest";
import { canStartServer, canStopServer } from "./serverManagement";
import type { ServerInstanceState } from "../api/types";
describe("server management lifecycle contracts", () => {
it("allows explicit starts from recoverable non-running states", () => {
const startable: ServerInstanceState[] = ["ready", "stopped", "failed"];
const blocked: ServerInstanceState[] = ["draft", "installing", "running", "deleted"];
expect(startable.every(canStartServer)).toBe(true);
expect(blocked.some(canStartServer)).toBe(false);
});
it("keeps stop limited to running servers", () => {
expect(canStopServer("running")).toBe(true);
expect(canStopServer("failed")).toBe(false);
});
});