Files
archie/ui/test/provider-input.test.ts
T
sam 21980f9ced
Quality / check (pull_request) Successful in 3m2s
fix(ui): include base URL when creating providers
2026-11-27 05:17:07 +11:00

23 lines
923 B
TypeScript

import assert from "node:assert/strict";
import test from "node:test";
import { canCreateProvider, providerInput } from "../src/settings/provider-input.ts";
test("new provider sends the caller's explicit base URL", () => {
assert.deepEqual(
providerInput({ name: " llama-swap ", class: "openai-compatible", base_url: " https://gateway.example/v1 " }),
{
name: "llama-swap",
class: "openai-compatible",
base_url: "https://gateway.example/v1",
api_key_credential_id: undefined,
},
);
});
test("a provider class without a default requires a base URL before creation", () => {
assert.equal(canCreateProvider("llama-swap", "openai-compatible", "", undefined), false);
assert.equal(canCreateProvider("llama-swap", "openai-compatible", "https://gateway.example/v1", undefined), true);
assert.equal(canCreateProvider("openai", "openai", "", "https://api.openai.com/v1"), true);
});