CoDEVX / lib /llm-config.test.ts
Tiger's Macbook Air
Build agentic PM demo app
3f76ff4
import { describe, expect, it } from "vitest";
import {
DEFAULT_LLM_BASE_URL,
DEFAULT_LLM_MODEL,
isAnthropicCompatibleBaseUrl,
isLlmConfigReady,
normalizeLlmConfig,
} from "./llm-config";
describe("llm-config", () => {
it("normalizes DeepSeek-compatible settings", () => {
const config = normalizeLlmConfig({
apiKey: "sk-test",
baseUrl: "https://api.deepseek.com/anthropic///",
model: " ",
});
expect(config.apiKey).toBe("sk-test");
expect(config.baseUrl).toBe(DEFAULT_LLM_BASE_URL);
expect(config.model).toBe(DEFAULT_LLM_MODEL);
expect(isAnthropicCompatibleBaseUrl(config.baseUrl)).toBe(true);
});
it("checks whether a user-provided config is ready for live calls", () => {
expect(
isLlmConfigReady({
apiKey: "",
baseUrl: DEFAULT_LLM_BASE_URL,
model: DEFAULT_LLM_MODEL,
}),
).toBe(false);
expect(
isLlmConfigReady({
apiKey: "sk-live",
baseUrl: DEFAULT_LLM_BASE_URL,
model: DEFAULT_LLM_MODEL,
}),
).toBe(true);
});
});