Fix server create plugin filtering
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import type { GamePluginResponse, ServerInstanceResponse } from "../api/types";
|
||||
import { defaultServerCreateForm } from "../contracts/serverManagement";
|
||||
import { defaultServerCreateForm, pluginCreateInputValues, serverCreatePluginOptions } from "../contracts/serverManagement";
|
||||
import { minimalServerCreateRequestFromForm, serverCreateRequestFromForm, serverInstanceIdFromName, serverLifecycleCommandRequest } from "./serverManagement";
|
||||
|
||||
const plugin: GamePluginResponse = {
|
||||
@@ -112,4 +112,18 @@ describe("runtime profile server creation contracts", () => {
|
||||
expect("profileKey" in (request.deployment ?? {})).toBe(false);
|
||||
expect("runtimeBindings" in (request.deployment ?? {})).toBe(false);
|
||||
});
|
||||
|
||||
it("keeps the create picker focused on canonical create-capable plugins", () => {
|
||||
const examplePlugin = { ...plugin, id: "game.example", name: "Example Server", serverType: "example", serverDisplayName: "Example Server", createFields: [], tags: ["development"] };
|
||||
const staleScumPlugin = { ...plugin, id: "game.scum.codex.20260804095301", name: "SCUM Server", version: "0.1.4", serverType: "scum", serverDisplayName: "SCUM Dedicated Server", manifestRef: "plugins/examples/scum-server-plugin/game.scum.codex.20260804095301/manifest.json", tags: ["scum"] };
|
||||
const scumPlugin = { ...staleScumPlugin, id: "game.scum", version: "0.1.15", manifestRef: "artifact://manifests/game.scum/0.1.15", createFields: [{ key: "gamePort", label: "游戏端口", type: "port" as const, required: true, defaultValue: "7779" }] };
|
||||
|
||||
const options = serverCreatePluginOptions([examplePlugin, staleScumPlugin, scumPlugin]);
|
||||
expect(options.map((item) => item.id)).toEqual(["game.scum", "game.example"]);
|
||||
expect(defaultServerCreateForm(options)).toMatchObject({ pluginId: "game.scum", createInputs: { gamePort: "7779" } });
|
||||
});
|
||||
|
||||
it("merges saved create inputs over plugin defaults", () => {
|
||||
expect(pluginCreateInputValues(plugin, { maxPlayers: "96" })).toEqual({ gamePort: "7777", maxPlayers: "96" });
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user