79 lines
2.5 KiB
TypeScript
79 lines
2.5 KiB
TypeScript
import assert from "node:assert/strict";
|
|
import test from "node:test";
|
|
|
|
import {
|
|
getIntegrationReadiness,
|
|
integrationReadinessDefinitions,
|
|
} from "../lib/operational-readiness";
|
|
|
|
test("integration readiness covers all MVP providers", () => {
|
|
assert.deepEqual(
|
|
integrationReadinessDefinitions.map((definition) => definition.id),
|
|
[
|
|
"local_business_data",
|
|
"pagespeed",
|
|
"openrouter",
|
|
"screenshotone",
|
|
"smtp",
|
|
"convex_jobs",
|
|
"rybbit",
|
|
"jina",
|
|
],
|
|
);
|
|
});
|
|
|
|
test("integration readiness reports missing configuration without leaking values", () => {
|
|
const rows = getIntegrationReadiness({
|
|
LOCAL_BUSINESS_DATA_API_KEY: "secret-local-business",
|
|
PAGESPEED_API_KEY: "",
|
|
});
|
|
|
|
const localBusinessData = rows.find((row) => row.id === "local_business_data");
|
|
const pageSpeed = rows.find((row) => row.id === "pagespeed");
|
|
|
|
assert.equal(localBusinessData?.status, "configured");
|
|
assert.equal(pageSpeed?.status, "missing");
|
|
assert.equal(JSON.stringify(rows).includes("secret-local-business"), false);
|
|
});
|
|
|
|
test("integration readiness treats ScreenshotOne as required and Jina as optional", () => {
|
|
const rows = getIntegrationReadiness({
|
|
LOCAL_BUSINESS_DATA_API_KEY: "secret-local-business",
|
|
PAGESPEED_API_KEY: "secret-pagespeed",
|
|
PAGESPEED_TIMEOUT_MS: "60000",
|
|
OPENROUTER_API_KEY: "secret-openrouter",
|
|
SMTP_HOST: "smtp.example.com",
|
|
SMTP_USER: "user",
|
|
SMTP_PASSWORD: "password",
|
|
SMTP_FROM: "Audit <audit@example.com>",
|
|
NEXT_PUBLIC_CONVEX_URL: "https://example.convex.cloud",
|
|
CONVEX_DEPLOYMENT: "prod:example",
|
|
RYBBIT_API_URL: "https://analytics.example.com",
|
|
RYBBIT_API_KEY: "secret-rybbit",
|
|
NEXT_PUBLIC_RYBBIT_SITE_ID: "site-id",
|
|
});
|
|
|
|
const screenshotOne = rows.find((row) => row.id === "screenshotone");
|
|
const jina = rows.find((row) => row.id === "jina");
|
|
|
|
assert.equal(screenshotOne?.status, "missing");
|
|
assert.deepEqual(screenshotOne?.missingEnv, ["SCREENSHOTONE_API_KEY"]);
|
|
assert.equal(jina?.status, "configured");
|
|
assert.deepEqual(jina?.missingEnv, []);
|
|
});
|
|
|
|
test("integration readiness no longer requires Playwright for the new pipeline", () => {
|
|
const definitionIds = integrationReadinessDefinitions.map((definition) => definition.id as string);
|
|
|
|
assert.equal(
|
|
definitionIds.includes("playwright"),
|
|
false,
|
|
);
|
|
assert.equal(
|
|
integrationReadinessDefinitions.some((definition) =>
|
|
definition.requiredEnv.includes("TASK8_BROWSER_ASSET_URL"),
|
|
),
|
|
false,
|
|
);
|
|
});
|