fix: expose server deployment trigger

This commit is contained in:
npc0-hue
2026-07-28 15:11:01 +08:00
parent e4ef4024a8
commit c5806cc6b7
10 changed files with 151 additions and 5 deletions
@@ -1,7 +1,7 @@
import { describe, expect, it } from "vitest";
import type { GamePluginResponse } from "../api/types";
import { defaultServerCreateForm, runtimeBindingFields } from "../contracts/serverManagement";
import { canDeployServer, defaultServerCreateForm, runtimeBindingFields } from "../contracts/serverManagement";
import { serverCreateRequestFromForm, serverInstanceIdFromName } from "./serverManagement";
const plugin: GamePluginResponse = {
@@ -42,6 +42,13 @@ const plugin: GamePluginResponse = {
};
describe("runtime profile server creation contracts", () => {
it("allows deployment only from draft or failed server states", () => {
expect(canDeployServer("draft")).toBe(true);
expect(canDeployServer("failed")).toBe(true);
expect(canDeployServer("installing")).toBe(false);
expect(canDeployServer("ready")).toBe(false);
});
it("derives logical binding fields from the selected profile", () => {
expect(runtimeBindingFields(plugin, "local")).toEqual([
{ key: "java-runtime", required: false, sensitive: false },