23 lines
923 B
TypeScript
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);
|
|
});
|