test(lmstudio): fix model load response mocks · openclaw/openclaw@7c56877
vincentkoc
·
2026-06-24
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -59,21 +59,6 @@ describe("lmstudio-models", () => {
|
59 | 59 | } |
60 | 60 | return JSON.parse(init.body) as unknown; |
61 | 61 | }; |
62 | | -// The model fetch/load helpers now read bodies through the shared byte-capped |
63 | | -// reader, so success-path mocks must be real Response objects with a body |
64 | | -// stream rather than bare `{ ok, json }` placeholders. |
65 | | -const jsonResponse = (payload: unknown, init?: ResponseInit): Response => |
66 | | -new Response(JSON.stringify(payload), { |
67 | | -status: 200, |
68 | | -headers: { "content-type": "application/json" }, |
69 | | - ...init, |
70 | | -}); |
71 | | -const malformedJsonResponse = (init?: ResponseInit): Response => |
72 | | -new Response("{ this is not valid json", { |
73 | | -status: 200, |
74 | | -headers: { "content-type": "application/json" }, |
75 | | - ...init, |
76 | | -}); |
77 | 62 | const cancelTrackedResponse = ( |
78 | 63 | text: string, |
79 | 64 | init: ResponseInit, |
@@ -104,7 +89,6 @@ describe("lmstudio-models", () => {
|
104 | 89 | }) => |
105 | 90 | vi.fn(async (url: string | URL, _init?: RequestInit) => { |
106 | 91 | const key = params?.key ?? "qwen3-8b-instruct"; |
107 | | -void init; |
108 | 92 | if (String(url).endsWith("/api/v1/models")) { |
109 | 93 | return jsonResponse({ |
110 | 94 | models: [ |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。