Files
SnapOtter/tests/integration/tools/conversion-presets-smoke.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

42 lines
1.2 KiB
TypeScript

import { afterAll, beforeAll, describe, expect, it } from "vitest";
import { fixtures, readFixture } from "../../fixtures/index.js";
import {
buildTestApp,
createMultipartPayload,
loginAsAdmin,
type TestApp,
} from "../test-server.js";
let testApp: TestApp;
let token: string;
beforeAll(async () => {
testApp = await buildTestApp();
token = await loginAsAdmin(testApp.app);
}, 30_000);
afterAll(async () => {
await testApp.cleanup();
}, 10_000);
describe("conversion preset smoke", () => {
it("jpg-to-png returns a png (fast/200)", async () => {
const jpg = readFixture(fixtures.image.base.jpg100);
const { body, contentType } = createMultipartPayload([
{ name: "file", filename: "a.jpg", contentType: "image/jpeg", content: jpg },
{ name: "settings", content: JSON.stringify({}) },
]);
const res = await testApp.app.inject({
method: "POST",
url: "/api/v1/tools/image/jpg-to-png",
headers: { authorization: `Bearer ${token}`, "content-type": contentType },
body,
});
expect([200, 202]).toContain(res.statusCode);
if (res.statusCode === 200) {
const json = JSON.parse(res.body);
expect(json.downloadUrl).toMatch(/\.png$/);
}
});
});