test: tighten lmstudio provider assertions · openclaw/openclaw@b6c8314
shakkernerd
·
2026-05-11
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -35,16 +35,19 @@ function createRemoteProviderConfig(overrides?: Partial<ModelProviderConfig>): M
|
35 | 35 | describe("lmstudio plugin", () => { |
36 | 36 | it("canonicalizes base URLs during provider normalization", () => { |
37 | 37 | const provider = registerProvider(); |
| 38 | +const providerConfig = createRemoteProviderConfig({ |
| 39 | +baseUrl: "http://localhost:1234/api/v1/", |
| 40 | +}); |
38 | 41 | |
39 | 42 | expect( |
40 | 43 | provider?.normalizeConfig?.({ |
41 | 44 | provider: "lmstudio", |
42 | | -providerConfig: createRemoteProviderConfig({ |
43 | | -baseUrl: "http://localhost:1234/api/v1/", |
44 | | -}), |
| 45 | + providerConfig, |
45 | 46 | }), |
46 | | -).toMatchObject({ |
| 47 | +).toEqual({ |
| 48 | + ...providerConfig, |
47 | 49 | baseUrl: "http://localhost:1234/v1", |
| 50 | +request: { allowPrivateNetwork: true }, |
48 | 51 | }); |
49 | 52 | }); |
50 | 53 | |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -368,7 +368,10 @@ describe("lmstudio-models", () => {
|
368 | 368 | if (!loadCall) { |
369 | 369 | throw new Error("expected LM Studio model load request"); |
370 | 370 | } |
371 | | -expect(loadCall[1]).toMatchObject({ |
| 371 | +const loadInit = loadCall[1] as RequestInit; |
| 372 | +const { signal, ...stableLoadInit } = loadInit; |
| 373 | +expect(signal).toBeInstanceOf(AbortSignal); |
| 374 | +expect(stableLoadInit).toEqual({ |
372 | 375 | method: "POST", |
373 | 376 | headers: { |
374 | 377 | "X-Proxy-Auth": "required", |
@@ -380,7 +383,6 @@ describe("lmstudio-models", () => {
|
380 | 383 | context_length: 32768, |
381 | 384 | }), |
382 | 385 | }); |
383 | | -const loadInit = loadCall[1] as RequestInit; |
384 | 386 | const loadBody = parseJsonRequestBody(loadInit) as { context_length: number }; |
385 | 387 | expect(loadBody.context_length).not.toBe(LMSTUDIO_DEFAULT_LOAD_CONTEXT_LENGTH); |
386 | 388 | }); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。