Files
SnapOtter/tests/unit/shared/conversion-presets.test.ts
T
SnapOtterandGitHub 63a03d26f2 feat: pipeline templates, analytics opt-out, 83 conversion presets, positioning + e2e modernization
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.
2026-06-28 18:57:53 +08:00

35 lines
1.3 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { TOOLS } from "../../../packages/shared/src/constants.js";
import {
CONVERSION_PRESETS,
expandConversionPresets,
} from "../../../packages/shared/src/conversion-presets.js";
describe("conversion presets", () => {
it("defines 83 presets with unique ids", () => {
expect(CONVERSION_PRESETS.length).toBe(83);
const ids = CONVERSION_PRESETS.map((p) => p.id);
expect(new Set(ids).size).toBe(83);
});
it("every expanded preset is a valid Tool with route, keywords, modality", () => {
for (const tool of expandConversionPresets()) {
expect(tool.route).toBe(`/${tool.id}`);
expect(tool.keywords && tool.keywords.length).toBeGreaterThan(3);
expect(tool.modality).toBeTruthy();
expect(tool.executionHint).toMatch(/fast|long/);
}
});
it("presets are present in the exported TOOLS catalog", () => {
const toolIds = new Set(TOOLS.map((t) => t.id));
for (const p of CONVERSION_PRESETS) expect(toolIds.has(p.id)).toBe(true);
});
it("preset keywords include the natural phrasing", () => {
const jpgPng = expandConversionPresets().find((t) => t.id === "jpg-to-png");
expect(jpgPng?.keywords).toContain("jpg to png");
expect(jpgPng?.keywords).toContain("jpeg to png");
});
});