新增样例文章验收运行脚本
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
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]");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user