Files
paperclip-adapter-claude-k8s/src/server/config-schema.test.ts
T
Pawla Abdul ac2fe20294 Restore maxTurnsPerRun field, add config schema tests
Keep adapter-specific maxTurnsPerRun (default 1000) in the config
schema since the platform UI does not provide it for external adapters.
Platform-provided fields (model, effort, instructionsFilePath,
timeoutSec, graceSec) remain excluded to avoid duplication.

Add config-schema.test.ts with assertions that platform-provided
fields are absent and adapter-specific fields have correct defaults.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-04-12 18:32:49 +00:00

57 lines
1.9 KiB
TypeScript

import { describe, it, expect } from "vitest";
import { getConfigSchema } from "./config-schema.js";
interface ConfigFieldSchema {
key: string;
label: string;
type: string;
default?: unknown;
options?: { label: string; value: string }[];
}
describe("getConfigSchema", () => {
it("returns a non-empty schema", () => {
const schema = getConfigSchema();
expect(schema.fields.length).toBeGreaterThan(0);
});
it("does not include platform-provided fields", () => {
const schema = getConfigSchema();
const keys = schema.fields.map((f: ConfigFieldSchema) => f.key);
// These fields are provided by the platform and should not be duplicated
expect(keys).not.toContain("model");
expect(keys).not.toContain("effort");
expect(keys).not.toContain("instructionsFilePath");
expect(keys).not.toContain("timeoutSec");
expect(keys).not.toContain("graceSec");
});
it("maxTurnsPerRun defaults to 1000", () => {
const schema = getConfigSchema();
const field = schema.fields.find((f: ConfigFieldSchema) => f.key === "maxTurnsPerRun");
expect(field).toBeDefined();
expect(field!.type).toBe("number");
expect(field!.default).toBe(1000);
});
it("dangerouslySkipPermissions defaults to true", () => {
const schema = getConfigSchema();
const field = schema.fields.find((f: ConfigFieldSchema) => f.key === "dangerouslySkipPermissions");
expect(field).toBeDefined();
expect(field!.type).toBe("toggle");
expect(field!.default).toBe(true);
});
it("has imagePullPolicy as select with correct options", () => {
const schema = getConfigSchema();
const field = schema.fields.find((f: ConfigFieldSchema) => f.key === "imagePullPolicy");
expect(field).toBeDefined();
expect(field!.type).toBe("select");
expect(field!.options).toEqual([
{ label: "IfNotPresent", value: "IfNotPresent" },
{ label: "Always", value: "Always" },
{ label: "Never", value: "Never" },
]);
});
});