mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-22 23:41:07 +00:00
test: move chutes smoke to onboarding seams
Regeneration-Prompt: | Chutes CI was still failing before test discovery with a Node module-loader error tied to importing the extension entry module. Replace that test with extension-local onboarding coverage that still exercises real Chutes code but avoids the plugin entrypoint entirely. Keep the lane meaningful by checking provider catalog setup, alias registration, and default model wiring in onboard.ts.
This commit is contained in:
@@ -1,38 +0,0 @@
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import { registerSingleProviderPlugin } from "../../test/helpers/extensions/plugin-registration.js";
|
||||
|
||||
vi.mock("openclaw/plugin-sdk/provider-auth", () => ({
|
||||
buildOauthProviderAuthResult: vi.fn(),
|
||||
createProviderApiKeyAuthMethod: vi.fn((params: { methodId: string; label: string }) => ({
|
||||
id: params.methodId,
|
||||
label: params.label,
|
||||
kind: "api-key",
|
||||
})),
|
||||
loginChutes: vi.fn(),
|
||||
resolveOAuthApiKeyMarker: vi.fn((providerId: string) => `oauth:${providerId}`),
|
||||
}));
|
||||
|
||||
vi.mock("./onboard.js", () => ({
|
||||
CHUTES_DEFAULT_MODEL_REF: "chutes/test-model",
|
||||
applyChutesApiKeyConfig: vi.fn((cfg: unknown) => cfg),
|
||||
applyChutesProviderConfig: vi.fn((cfg: unknown) => cfg),
|
||||
}));
|
||||
|
||||
vi.mock("./provider-catalog.js", () => ({
|
||||
buildChutesProvider: vi.fn(async () => ({
|
||||
api: "openai-completions",
|
||||
baseUrl: "https://chutes.test",
|
||||
models: [],
|
||||
})),
|
||||
}));
|
||||
|
||||
describe("chutes provider plugin", () => {
|
||||
it("registers OAuth and API key auth flows under one provider", async () => {
|
||||
const { default: chutesPlugin } = await import("./index.js");
|
||||
const provider = registerSingleProviderPlugin(chutesPlugin);
|
||||
|
||||
expect(provider.id).toBe("chutes");
|
||||
expect(provider.auth.map((method) => method.id)).toEqual(["oauth", "api-key"]);
|
||||
expect(provider.catalog?.run).toEqual(expect.any(Function));
|
||||
});
|
||||
});
|
||||
56
extensions/chutes/onboard.test.ts
Normal file
56
extensions/chutes/onboard.test.ts
Normal file
@@ -0,0 +1,56 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
applyChutesApiKeyConfig,
|
||||
applyChutesConfig,
|
||||
applyChutesProviderConfig,
|
||||
CHUTES_DEFAULT_MODEL_REF,
|
||||
} from "./onboard.js";
|
||||
|
||||
describe("chutes onboarding config", () => {
|
||||
it("registers the Chutes provider catalog and aliases", () => {
|
||||
const cfg = applyChutesProviderConfig({});
|
||||
|
||||
expect(cfg.models?.providers?.chutes?.api).toBe("openai-completions");
|
||||
expect(cfg.models?.providers?.chutes?.baseUrl).toBe("https://llm.chutes.ai/v1");
|
||||
expect(cfg.models?.providers?.chutes?.models?.length).toBeGreaterThan(0);
|
||||
expect(cfg.agents?.defaults?.models?.["chutes-fast"]).toEqual({
|
||||
alias: "chutes/zai-org/GLM-4.7-FP8",
|
||||
});
|
||||
expect(cfg.agents?.defaults?.models?.["chutes-vision"]).toEqual({
|
||||
alias: "chutes/chutesai/Mistral-Small-3.2-24B-Instruct-2506",
|
||||
});
|
||||
expect(cfg.agents?.defaults?.models?.["chutes-pro"]).toEqual({
|
||||
alias: "chutes/deepseek-ai/DeepSeek-V3.2-TEE",
|
||||
});
|
||||
});
|
||||
|
||||
it("sets the default primary model for API key onboarding", () => {
|
||||
const cfg = applyChutesApiKeyConfig({
|
||||
agents: {
|
||||
defaults: {
|
||||
model: {
|
||||
fallbacks: ["existing-fallback"],
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
expect(cfg.agents?.defaults?.model).toEqual({
|
||||
primary: CHUTES_DEFAULT_MODEL_REF,
|
||||
fallbacks: ["existing-fallback"],
|
||||
});
|
||||
});
|
||||
|
||||
it("sets default text and image models for full onboarding", () => {
|
||||
const cfg = applyChutesConfig({});
|
||||
|
||||
expect(cfg.agents?.defaults?.model).toEqual({
|
||||
primary: CHUTES_DEFAULT_MODEL_REF,
|
||||
fallbacks: ["chutes/deepseek-ai/DeepSeek-V3.2-TEE", "chutes/Qwen/Qwen3-32B"],
|
||||
});
|
||||
expect(cfg.agents?.defaults?.imageModel).toEqual({
|
||||
primary: "chutes/chutesai/Mistral-Small-3.2-24B-Instruct-2506",
|
||||
fallbacks: ["chutes/chutesai/Mistral-Small-3.1-24B-Instruct-2503"],
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user