test: fix startup recovery model fixture types · openclaw/openclaw@da773cf
steipete
·
2026-04-28
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
|
1 | 1 | import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; |
2 | | -import type { ConfigFileSnapshot, OpenClawConfig } from "../config/types.js"; |
| 2 | +import type { ConfigFileSnapshot, ModelDefinitionConfig, OpenClawConfig } from "../config/types.js"; |
3 | 3 | import type { PluginMetadataSnapshot } from "../plugins/plugin-metadata-snapshot.js"; |
4 | 4 | import { buildTestConfigSnapshot } from "./test-helpers.config-snapshots.js"; |
5 | 5 | |
@@ -123,6 +123,23 @@ const validConfig = {
|
123 | 123 | }, |
124 | 124 | } as OpenClawConfig; |
125 | 125 | |
| 126 | +function testModel(id: string, name: string): ModelDefinitionConfig { |
| 127 | +return { |
| 128 | + id, |
| 129 | + name, |
| 130 | +reasoning: false, |
| 131 | +input: ["text"], |
| 132 | +cost: { |
| 133 | +input: 0, |
| 134 | +output: 0, |
| 135 | +cacheRead: 0, |
| 136 | +cacheWrite: 0, |
| 137 | +}, |
| 138 | +contextWindow: 8192, |
| 139 | +maxTokens: 4096, |
| 140 | +}; |
| 141 | +} |
| 142 | + |
126 | 143 | function buildSnapshot(params: { |
127 | 144 | valid: boolean; |
128 | 145 | raw: string; |
@@ -245,10 +262,7 @@ describe("gateway startup config recovery", () => {
|
245 | 262 | baseUrl: "https://dos.example.test/v1", |
246 | 263 | apiKey: "test-key", |
247 | 264 | api: "openai-completions", |
248 | | -models: [ |
249 | | -{ id: "dos-ai", name: "DOS AI" }, |
250 | | -{ id: "dos-auto", name: "DOS Auto" }, |
251 | | -], |
| 265 | +models: [testModel("dos-ai", "DOS AI"), testModel("dos-auto", "DOS Auto")], |
252 | 266 | }, |
253 | 267 | }, |
254 | 268 | }, |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。