mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
Lands five integrated branches: pipeline templates (#355), analytics opt-out (#354), 83 conversion presets bringing the catalog to 240 tools (#356), self-hosted positioning (#353), and e2e modernization (#351). Integration fixes: aligned stale web analytics tests with the opt-out/allow-list model, closed 3 CodeQL incomplete-sanitization alerts in the i18n generator, resolved settings/index/docs/format-matrix conflicts, and corrected tool counts to 240.
57 lines
1.9 KiB
TypeScript
57 lines
1.9 KiB
TypeScript
import {
|
|
getRequiredBundlesForTool,
|
|
PIPELINE_TEMPLATES,
|
|
templateRequiredBundles,
|
|
} from "@snapotter/shared";
|
|
import { afterAll, beforeAll, describe, expect, it } from "vitest";
|
|
import { getToolConfig } from "../../apps/api/src/routes/tool-factory.js";
|
|
import { buildTestApp, type TestApp } from "./test-server.js";
|
|
|
|
// Mirror of PASSWORD_TOOLS in apps/api/src/routes/pipeline.ts. These cannot be
|
|
// persisted or run in a saved/template pipeline.
|
|
const PASSWORD_TOOLS = new Set(["protect-pdf", "unlock-pdf"]);
|
|
|
|
describe("pipeline templates drift guard", () => {
|
|
let testApp: TestApp;
|
|
|
|
beforeAll(async () => {
|
|
testApp = await buildTestApp();
|
|
}, 30_000);
|
|
|
|
afterAll(async () => {
|
|
await testApp.cleanup();
|
|
}, 10_000);
|
|
|
|
it("every step's toolId is registry-runnable with valid settings", () => {
|
|
for (const tpl of PIPELINE_TEMPLATES) {
|
|
for (const step of tpl.steps) {
|
|
const config = getToolConfig(step.toolId);
|
|
expect(
|
|
config,
|
|
`template "${tpl.id}" references unregistered tool "${step.toolId}"`,
|
|
).toBeDefined();
|
|
expect(PASSWORD_TOOLS.has(step.toolId), `template "${tpl.id}" uses a password tool`).toBe(
|
|
false,
|
|
);
|
|
const parsed = config!.settingsSchema.safeParse(step.settings);
|
|
expect(
|
|
parsed.success,
|
|
`template "${tpl.id}" step "${step.toolId}" invalid settings: ${
|
|
parsed.success ? "" : JSON.stringify(parsed.error.issues)
|
|
}`,
|
|
).toBe(true);
|
|
}
|
|
}
|
|
});
|
|
|
|
it("derived required bundles match the per-tool bundle map", () => {
|
|
for (const tpl of PIPELINE_TEMPLATES) {
|
|
const expected = new Set<string>();
|
|
for (const step of tpl.steps) {
|
|
for (const b of getRequiredBundlesForTool(step.toolId)) expected.add(b);
|
|
}
|
|
expect(new Set(templateRequiredBundles(tpl))).toEqual(expected);
|
|
}
|
|
});
|
|
});
|