Co-authored-by: Cursor Agent <[email protected]> Co-authored-by: codex <[email protected]>
75 lines
2.1 KiB
TypeScript
75 lines
2.1 KiB
TypeScript
import * as Schema from "effect/Schema";
|
|
import { describe, expect, it } from "vitest";
|
|
|
|
import { ServerProvider } from "./server.ts";
|
|
|
|
const decodeServerProvider = Schema.decodeUnknownSync(ServerProvider);
|
|
|
|
describe("ServerProvider", () => {
|
|
it("defaults capability arrays when decoding provider snapshots", () => {
|
|
const parsed = decodeServerProvider({
|
|
instanceId: "codex",
|
|
driver: "codex",
|
|
enabled: true,
|
|
installed: true,
|
|
version: "1.0.0",
|
|
status: "ready",
|
|
auth: {
|
|
status: "authenticated",
|
|
},
|
|
checkedAt: "2026-04-10T00:00:00.000Z",
|
|
models: [],
|
|
});
|
|
|
|
expect(parsed.slashCommands).toEqual([]);
|
|
expect(parsed.skills).toEqual([]);
|
|
expect(parsed.versionAdvisory).toBeUndefined();
|
|
expect(parsed.updateState).toBeUndefined();
|
|
});
|
|
|
|
it("defaults one-click update support when decoding older advisory snapshots", () => {
|
|
const parsed = decodeServerProvider({
|
|
instanceId: "codex",
|
|
driver: "codex",
|
|
enabled: true,
|
|
installed: true,
|
|
version: "1.0.0",
|
|
status: "ready",
|
|
auth: {
|
|
status: "authenticated",
|
|
},
|
|
checkedAt: "2026-04-10T00:00:00.000Z",
|
|
models: [],
|
|
versionAdvisory: {
|
|
status: "behind_latest",
|
|
currentVersion: "1.0.0",
|
|
latestVersion: "1.0.1",
|
|
updateCommand: "npm install -g @openai/codex@latest",
|
|
checkedAt: "2026-04-10T00:00:00.000Z",
|
|
message: "Update available.",
|
|
},
|
|
});
|
|
|
|
expect(parsed.versionAdvisory?.canUpdate).toBe(false);
|
|
});
|
|
|
|
it("decodes continuation group metadata", () => {
|
|
const parsed = decodeServerProvider({
|
|
instanceId: "codex_personal",
|
|
driver: "codex",
|
|
continuation: { groupKey: "codex:home:/Users/julius/.codex" },
|
|
enabled: true,
|
|
installed: true,
|
|
version: "1.0.0",
|
|
status: "ready",
|
|
auth: {
|
|
status: "authenticated",
|
|
},
|
|
checkedAt: "2026-04-10T00:00:00.000Z",
|
|
models: [],
|
|
});
|
|
|
|
expect(parsed.continuation?.groupKey).toBe("codex:home:/Users/julius/.codex");
|
|
});
|
|
});
|