24 lines
871 B
TypeScript
24 lines
871 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
import type { OpenClawConfig } from "../config/config.js";
|
|
import { applyAgentDefaultPrimaryModel } from "./model-default.js";
|
|
|
|
describe("applyAgentDefaultPrimaryModel", () => {
|
|
it("does not mutate when already set", () => {
|
|
const cfg = { agents: { defaults: { model: { primary: "a/b" } } } } as OpenClawConfig;
|
|
const result = applyAgentDefaultPrimaryModel({ cfg, model: "a/b" });
|
|
expect(result.changed).toBe(false);
|
|
expect(result.next).toBe(cfg);
|
|
});
|
|
|
|
it("normalizes legacy models", () => {
|
|
const cfg = { agents: { defaults: { model: { primary: "legacy" } } } } as OpenClawConfig;
|
|
const result = applyAgentDefaultPrimaryModel({
|
|
cfg,
|
|
model: "a/b",
|
|
legacyModels: new Set(["legacy"]),
|
|
});
|
|
expect(result.changed).toBe(false);
|
|
expect(result.next).toBe(cfg);
|
|
});
|
|
});
|