mirror of
https://github.com/murashit/codex-panel.git
synced 2026-07-22 17:30:31 +00:00
75 lines
2.9 KiB
TypeScript
75 lines
2.9 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
|
|
import {
|
|
appServerApprovalsReviewerOrNull,
|
|
appServerAutoReviewApprovalsReviewer,
|
|
appServerCollaborationMode,
|
|
applyThreadSettingsValue,
|
|
clearedServiceTierRequestValue,
|
|
configuredServiceTierRequestValue,
|
|
parseServiceTier,
|
|
serviceTierRequestValue,
|
|
type ThreadSettingsUpdate,
|
|
} from "../../src/app-server/thread-settings";
|
|
|
|
describe("app-server thread settings", () => {
|
|
it("applies defined thread setting values and omits undefined values", () => {
|
|
const update: ThreadSettingsUpdate = {};
|
|
|
|
applyThreadSettingsValue(update, "model", "gpt-5.5");
|
|
applyThreadSettingsValue(update, "effort", null);
|
|
applyThreadSettingsValue(update, "serviceTier", undefined);
|
|
|
|
expect(update).toEqual({ model: "gpt-5.5", effort: null });
|
|
});
|
|
|
|
it("parses supported approvals reviewer values", () => {
|
|
expect(appServerApprovalsReviewerOrNull("user")).toBe("user");
|
|
expect(appServerApprovalsReviewerOrNull("auto_review")).toBe("auto_review");
|
|
expect(appServerApprovalsReviewerOrNull("guardian_subagent")).toBe("guardian_subagent");
|
|
expect(appServerApprovalsReviewerOrNull("unknown")).toBeNull();
|
|
});
|
|
|
|
it("maps panel auto-review state to app-server reviewer values", () => {
|
|
expect(appServerAutoReviewApprovalsReviewer(true)).toBe("auto_review");
|
|
expect(appServerAutoReviewApprovalsReviewer(false)).toBe("user");
|
|
});
|
|
|
|
it("builds collaboration mode payloads with built-in instructions", () => {
|
|
expect(appServerCollaborationMode("plan", "gpt-5.5", "high")).toEqual({
|
|
mode: "plan",
|
|
settings: {
|
|
model: "gpt-5.5",
|
|
reasoning_effort: "high",
|
|
developer_instructions: null,
|
|
},
|
|
});
|
|
});
|
|
|
|
it("accepts non-empty service tier ids from config and app-server reports", () => {
|
|
expect(parseServiceTier("fast")).toBe("fast");
|
|
expect(parseServiceTier("standard")).toBe("standard");
|
|
expect(parseServiceTier("priority")).toBe("priority");
|
|
expect(parseServiceTier("default")).toBe("default");
|
|
expect(parseServiceTier("flex")).toBe("flex");
|
|
expect(parseServiceTier("auto")).toBe("auto");
|
|
expect(parseServiceTier("catalog-tier")).toBe("catalog-tier");
|
|
});
|
|
|
|
it("ignores absent service tier values", () => {
|
|
expect(parseServiceTier("")).toBeNull();
|
|
expect(parseServiceTier(null)).toBeNull();
|
|
});
|
|
|
|
it("serializes service tier thread settings requests", () => {
|
|
expect(serviceTierRequestValue("fast")).toBe("fast");
|
|
expect(serviceTierRequestValue("priority")).toBe("priority");
|
|
expect(clearedServiceTierRequestValue()).toBeNull();
|
|
});
|
|
|
|
it("passes configured service tier ids through to new turns", () => {
|
|
expect(configuredServiceTierRequestValue("flex")).toBe("flex");
|
|
expect(configuredServiceTierRequestValue("catalog-tier")).toBe("catalog-tier");
|
|
expect(configuredServiceTierRequestValue(null)).toBeUndefined();
|
|
});
|
|
});
|