46 lines
1022 B
TypeScript
46 lines
1022 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
|
|
import {
|
|
parseEnvFile,
|
|
preflight,
|
|
redact,
|
|
} from "../../scripts/run-geo-sample-e2e.mjs";
|
|
|
|
describe("run-geo-sample-e2e helpers", () => {
|
|
it("parses simple dotenv files while ignoring comments", () => {
|
|
expect(
|
|
parseEnvFile(`
|
|
# comment
|
|
API_ACCESS_KEY=local-dev-key
|
|
DEEPSEEK_API_KEY="secret"
|
|
EMPTY=
|
|
`),
|
|
).toEqual({
|
|
API_ACCESS_KEY: "local-dev-key",
|
|
DEEPSEEK_API_KEY: "secret",
|
|
EMPTY: "",
|
|
});
|
|
});
|
|
|
|
it("requires a provider key in live mode", () => {
|
|
expect(() =>
|
|
preflight(
|
|
{
|
|
API_ACCESS_KEY: "local-dev-key",
|
|
LLM_PROVIDER: "deepseek",
|
|
},
|
|
"deepseek",
|
|
),
|
|
).toThrow("DEEPSEEK_API_KEY is required for live sample E2E");
|
|
});
|
|
|
|
it("redacts configured secrets from logs", () => {
|
|
expect(
|
|
redact("x-api-key: local-dev-key provider secret", [
|
|
"local-dev-key",
|
|
"provider secret",
|
|
]),
|
|
).toBe("x-api-key: [REDACTED] [REDACTED]");
|
|
});
|
|
});
|