test: tighten models config assertions · openclaw/openclaw@24d9e16
steipete
·
2026-05-09
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -50,10 +50,8 @@ describe("models-config: explicit reasoning override", () => {
|
50 | 50 | it("preserves user reasoning:false when the built-in catalog has reasoning:true", () => { |
51 | 51 | const merged = mergedMinimaxModel(createMinimaxModel({ reasoning: false })); |
52 | 52 | |
53 | | -expect(merged).toMatchObject({ |
54 | | -id: MINIMAX_MODEL_ID, |
55 | | -reasoning: false, |
56 | | -}); |
| 53 | +expect(merged?.id).toBe(MINIMAX_MODEL_ID); |
| 54 | +expect(merged?.reasoning).toBe(false); |
57 | 55 | }); |
58 | 56 | |
59 | 57 | it("keeps reasoning unset when user omits the field", () => { |
@@ -64,7 +62,7 @@ describe("models-config: explicit reasoning override", () => {
|
64 | 62 | }, |
65 | 63 | }).minimax?.models?.find((model) => model.id === MINIMAX_MODEL_ID); |
66 | 64 | |
67 | | -expect(merged).toEqual(expect.objectContaining({ id: MINIMAX_MODEL_ID })); |
| 65 | +expect(merged?.id).toBe(MINIMAX_MODEL_ID); |
68 | 66 | expect(merged).not.toHaveProperty("reasoning"); |
69 | 67 | }); |
70 | 68 | }); |
| Original file line number | Diff line number | Diff line change |
|---|
@@ -115,16 +115,12 @@ describe("StepFun provider catalog", () => {
|
115 | 115 | throw new Error("expected StepFun providers"); |
116 | 116 | } |
117 | 117 | |
118 | | -expect(standardProvider).toMatchObject({ |
119 | | -baseUrl: "https://api.stepfun.ai/v1", |
120 | | -api: "openai-completions", |
121 | | -apiKey: "STEPFUN_API_KEY", |
122 | | -}); |
123 | | -expect(planProvider).toMatchObject({ |
124 | | -baseUrl: "https://api.stepfun.ai/step_plan/v1", |
125 | | -api: "openai-completions", |
126 | | -apiKey: "STEPFUN_API_KEY", |
127 | | -}); |
| 118 | +expect(standardProvider.baseUrl).toBe("https://api.stepfun.ai/v1"); |
| 119 | +expect(standardProvider.api).toBe("openai-completions"); |
| 120 | +expect(standardProvider.apiKey).toBe("STEPFUN_API_KEY"); |
| 121 | +expect(planProvider.baseUrl).toBe("https://api.stepfun.ai/step_plan/v1"); |
| 122 | +expect(planProvider.api).toBe("openai-completions"); |
| 123 | +expect(planProvider.apiKey).toBe("STEPFUN_API_KEY"); |
128 | 124 | expect(standardProvider.models?.map((model) => model.id)).toEqual(EXPECTED_STANDARD_MODELS); |
129 | 125 | expect(planProvider.models?.map((model) => model.id)).toEqual(EXPECTED_PLAN_MODELS); |
130 | 126 | }); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -111,7 +111,6 @@ async function runEnvProviderCase(params: {
|
111 | 111 | const raw = await fs.readFile(modelPath, "utf8"); |
112 | 112 | const parsed = JSON.parse(raw) as { providers: Record<string, ParsedProviderConfig> }; |
113 | 113 | const provider = parsed.providers[params.providerKey]; |
114 | | -expect(provider).toMatchObject({ apiKey: params.expectedApiKeyRef }); |
115 | 114 | expect(provider?.apiKey).toBe(params.expectedApiKeyRef); |
116 | 115 | } finally { |
117 | 116 | if (previousValue === undefined) { |
@@ -193,10 +192,9 @@ describe("models-config", () => {
|
193 | 192 | }; |
194 | 193 | |
195 | 194 | expect(parsed.providers["custom-proxy"]?.baseUrl).toBe("http://localhost:4000/v1"); |
196 | | -expect(parsed.providers["custom-proxy"]?.models?.[0]).toMatchObject({ |
197 | | -id: "llama-3.1-8b", |
198 | | -cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 }, |
199 | | -}); |
| 195 | +const model = parsed.providers["custom-proxy"]?.models?.[0]; |
| 196 | +expect(model?.id).toBe("llama-3.1-8b"); |
| 197 | +expect(model?.cost).toEqual({ input: 0, output: 0, cacheRead: 0, cacheWrite: 0 }); |
200 | 198 | }); |
201 | 199 | }); |
202 | 200 | |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。