Test: cover z.ai normalization
This commit is contained in:
committed by
Peter Steinberger
parent
0ddfbf5534
commit
8954f7719c
@@ -73,9 +73,37 @@ describe("resolveConfiguredModelRef", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("still resolves legacy agent.model string", () => {
|
||||
it("normalizes z.ai provider in agent.model", () => {
|
||||
const cfg = {
|
||||
agent: { model: "openai/gpt-4.1-mini" },
|
||||
agent: { model: "z.ai/glm-4.7" },
|
||||
} satisfies ClawdbotConfig;
|
||||
|
||||
const resolved = resolveConfiguredModelRef({
|
||||
cfg,
|
||||
defaultProvider: DEFAULT_PROVIDER,
|
||||
defaultModel: DEFAULT_MODEL,
|
||||
});
|
||||
|
||||
expect(resolved).toEqual({ provider: "zai", model: "glm-4.7" });
|
||||
});
|
||||
|
||||
it("normalizes z-ai provider in agent.model", () => {
|
||||
const cfg = {
|
||||
agent: { model: "z-ai/glm-4.7" },
|
||||
} satisfies ClawdbotConfig;
|
||||
|
||||
const resolved = resolveConfiguredModelRef({
|
||||
cfg,
|
||||
defaultProvider: DEFAULT_PROVIDER,
|
||||
defaultModel: DEFAULT_MODEL,
|
||||
});
|
||||
|
||||
expect(resolved).toEqual({ provider: "zai", model: "glm-4.7" });
|
||||
});
|
||||
|
||||
it("normalizes provider casing in agent.model", () => {
|
||||
const cfg = {
|
||||
agent: { model: "OpenAI/gpt-4.1-mini" },
|
||||
} satisfies ClawdbotConfig;
|
||||
|
||||
const resolved = resolveConfiguredModelRef({
|
||||
@@ -86,4 +114,18 @@ describe("resolveConfiguredModelRef", () => {
|
||||
|
||||
expect(resolved).toEqual({ provider: "openai", model: "gpt-4.1-mini" });
|
||||
});
|
||||
|
||||
it("normalizes z.ai casing in agent.model", () => {
|
||||
const cfg = {
|
||||
agent: { model: "Z.AI/glm-4.7" },
|
||||
} satisfies ClawdbotConfig;
|
||||
|
||||
const resolved = resolveConfiguredModelRef({
|
||||
cfg,
|
||||
defaultProvider: DEFAULT_PROVIDER,
|
||||
defaultModel: DEFAULT_MODEL,
|
||||
});
|
||||
|
||||
expect(resolved).toEqual({ provider: "zai", model: "glm-4.7" });
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user