test: tighten lmstudio provider assertions

This commit is contained in:
Shakker
2026-05-11 07:18:23 +01:00
parent 8d2b1c15f6
commit b6c8314b04
2 changed files with 11 additions and 6 deletions

View File

@@ -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 },
});
});

View File

@@ -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);
});