mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 05:30:43 +00:00
test: tighten provider config helper assertions
This commit is contained in:
@@ -79,7 +79,6 @@ describe("chutes-models", () => {
|
||||
expect(def.cost).toEqual(entry.cost);
|
||||
expect(def.contextWindow).toBe(entry.contextWindow);
|
||||
expect(def.maxTokens).toBe(entry.maxTokens);
|
||||
expect(def.compat).toBeDefined();
|
||||
if (!def.compat) {
|
||||
throw new Error("expected Chutes model compat");
|
||||
}
|
||||
@@ -124,7 +123,6 @@ describe("chutes-models", () => {
|
||||
const secondModel = requireChutesModel(models, 1);
|
||||
expect(firstModel.id).toBe("zai-org/GLM-4.7-TEE");
|
||||
expect(secondModel.reasoning).toBe(true);
|
||||
expect(secondModel.compat).toBeDefined();
|
||||
if (!secondModel.compat) {
|
||||
throw new Error("expected Chutes API model compat");
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ import plugin from "./index.js";
|
||||
function registerProvider() {
|
||||
const captured = capturePluginRegistration(plugin);
|
||||
const provider = captured.providers[0];
|
||||
expect(provider).toBeDefined();
|
||||
if (!provider) {
|
||||
throw new Error("expected Cloudflare AI Gateway provider");
|
||||
}
|
||||
@@ -53,7 +52,6 @@ describe("cloudflare-ai-gateway plugin", () => {
|
||||
{},
|
||||
);
|
||||
|
||||
expect(capturedPayload).toBeDefined();
|
||||
if (!capturedPayload) {
|
||||
throw new Error("expected Cloudflare AI Gateway payload capture");
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@ describe("exa web search provider", () => {
|
||||
expect(provider.onboardingScopes).toEqual(["text-inference"]);
|
||||
expect(provider.credentialPath).toBe("plugins.entries.exa.config.webSearch.apiKey");
|
||||
const pluginEntry = applied.plugins?.entries?.exa;
|
||||
expect(pluginEntry).toBeDefined();
|
||||
if (!pluginEntry) {
|
||||
throw new Error("expected Exa plugin entry");
|
||||
}
|
||||
@@ -45,7 +44,6 @@ describe("exa web search provider", () => {
|
||||
});
|
||||
expect(contractProvider.createTool({ config: {}, searchConfig: {} })).toBeNull();
|
||||
const pluginEntry = applied.plugins?.entries?.exa;
|
||||
expect(pluginEntry).toBeDefined();
|
||||
if (!pluginEntry) {
|
||||
throw new Error("expected contract Exa plugin entry");
|
||||
}
|
||||
|
||||
@@ -48,7 +48,6 @@ describe("fireworks provider plugin", () => {
|
||||
expect(provider.aliases).toEqual(["fireworks-ai"]);
|
||||
expect(provider.envVars).toEqual(["FIREWORKS_API_KEY"]);
|
||||
expect(provider.auth).toHaveLength(1);
|
||||
expect(resolved).toBeDefined();
|
||||
if (!resolved) {
|
||||
throw new Error("expected Fireworks api-key auth choice");
|
||||
}
|
||||
@@ -63,7 +62,6 @@ describe("fireworks provider plugin", () => {
|
||||
expect(catalogProvider.api).toBe("openai-completions");
|
||||
expect(catalogProvider.baseUrl).toBe(FIREWORKS_BASE_URL);
|
||||
const models = catalogProvider.models;
|
||||
expect(models).toBeDefined();
|
||||
if (!models) {
|
||||
throw new Error("expected Fireworks catalog models");
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ import {
|
||||
type QwenProvider = ReturnType<typeof buildQwenProvider>;
|
||||
|
||||
function getQwenModelIds(provider: QwenProvider): string[] {
|
||||
expect(provider.models).toBeDefined();
|
||||
return provider.models.map((model) => model.id);
|
||||
}
|
||||
|
||||
@@ -43,7 +42,6 @@ describe("qwen provider catalog", () => {
|
||||
expect(nativeProvider.models.length).toBeGreaterThan(0);
|
||||
expect(
|
||||
nativeProvider.models.every((model) => {
|
||||
expect(model.compat).toBeDefined();
|
||||
if (!model.compat) {
|
||||
throw new Error(`expected Qwen model ${model.id} compat`);
|
||||
}
|
||||
|
||||
@@ -51,7 +51,6 @@ function makePrompter(confirmValue: boolean): DoctorPrompter {
|
||||
}
|
||||
|
||||
function requireAuthConfig(config: OpenClawConfig): NonNullable<OpenClawConfig["auth"]> {
|
||||
expect(config.auth).toBeDefined();
|
||||
if (!config.auth) {
|
||||
throw new Error("expected repaired auth config");
|
||||
}
|
||||
|
||||
@@ -85,7 +85,6 @@ async function readPersistedJobs(storePath: string): Promise<Array<Record<string
|
||||
|
||||
function requirePersistedJob(jobs: Array<Record<string, unknown>>, index: number) {
|
||||
const job = jobs[index];
|
||||
expect(job).toBeDefined();
|
||||
if (!job) {
|
||||
throw new Error(`expected persisted cron job ${index}`);
|
||||
}
|
||||
|
||||
@@ -36,7 +36,6 @@ async function loadProviderRegistry() {
|
||||
|
||||
function requireImageProvider(id: string): ImageGenerationProviderPlugin {
|
||||
const provider = getImageGenerationProvider(id);
|
||||
expect(provider).toBeDefined();
|
||||
if (!provider) {
|
||||
throw new Error(`expected image generation provider ${id}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user