mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-18 17:14:45 +00:00
test: tighten lmstudio provider assertions
This commit is contained in:
@@ -35,16 +35,19 @@ function createRemoteProviderConfig(overrides?: Partial<ModelProviderConfig>): M
|
||||
describe("lmstudio plugin", () => {
|
||||
it("canonicalizes base URLs during provider normalization", () => {
|
||||
const provider = registerProvider();
|
||||
const providerConfig = createRemoteProviderConfig({
|
||||
baseUrl: "http://localhost:1234/api/v1/",
|
||||
});
|
||||
|
||||
expect(
|
||||
provider?.normalizeConfig?.({
|
||||
provider: "lmstudio",
|
||||
providerConfig: createRemoteProviderConfig({
|
||||
baseUrl: "http://localhost:1234/api/v1/",
|
||||
}),
|
||||
providerConfig,
|
||||
}),
|
||||
).toMatchObject({
|
||||
).toEqual({
|
||||
...providerConfig,
|
||||
baseUrl: "http://localhost:1234/v1",
|
||||
request: { allowPrivateNetwork: true },
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -368,7 +368,10 @@ describe("lmstudio-models", () => {
|
||||
if (!loadCall) {
|
||||
throw new Error("expected LM Studio model load request");
|
||||
}
|
||||
expect(loadCall[1]).toMatchObject({
|
||||
const loadInit = loadCall[1] as RequestInit;
|
||||
const { signal, ...stableLoadInit } = loadInit;
|
||||
expect(signal).toBeInstanceOf(AbortSignal);
|
||||
expect(stableLoadInit).toEqual({
|
||||
method: "POST",
|
||||
headers: {
|
||||
"X-Proxy-Auth": "required",
|
||||
@@ -380,7 +383,6 @@ describe("lmstudio-models", () => {
|
||||
context_length: 32768,
|
||||
}),
|
||||
});
|
||||
const loadInit = loadCall[1] as RequestInit;
|
||||
const loadBody = parseJsonRequestBody(loadInit) as { context_length: number };
|
||||
expect(loadBody.context_length).not.toBe(LMSTUDIO_DEFAULT_LOAD_CONTEXT_LENGTH);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user