mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
test: add regression coverage for the video QA fixes
friendlyError unit test (incl. the false-positive guard); gated integration tests for multi-file video batch and a multi-step video pipeline (regression for the modality-aware batch/pipeline fix). All pass locally; existing image batch (36) and pipeline (37) suites remain green, and the existing gif-to-video webm test now passes with the pix_fmt fix.
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
|
||||
import { readFileSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
import { ffmpegAvailable } from "@snapotter/media-engine";
|
||||
import { afterAll, beforeAll, describe, expect, it } from "vitest";
|
||||
import { buildTestApp, createMultipartPayload, loginAsAdmin, type TestApp } from "./test-server.js";
|
||||
|
||||
@@ -15,6 +16,7 @@ import { buildTestApp, createMultipartPayload, loginAsAdmin, type TestApp } from
|
||||
// ---------------------------------------------------------------------------
|
||||
const FIXTURES = join(__dirname, "..", "fixtures");
|
||||
const PNG_200x150 = readFileSync(join(FIXTURES, "test-200x150.png"));
|
||||
const TINY_MP4 = readFileSync(join(FIXTURES, "media", "tiny.mp4"));
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Shared state
|
||||
@@ -792,3 +794,45 @@ describe("Pipeline execution response", () => {
|
||||
expect(dlRes.rawPayload.length).toBeGreaterThan(0);
|
||||
});
|
||||
});
|
||||
|
||||
// ═══════════════════════════════════════════════════════════════════════════
|
||||
// NON-IMAGE PIPELINE (regression)
|
||||
// ═══════════════════════════════════════════════════════════════════════════
|
||||
// Pipeline execute used to hardcode image validation and rejected video inputs
|
||||
// with "Invalid image". It now validates via the first step's modality handler.
|
||||
describe.skipIf(!ffmpegAvailable())("Non-image pipeline (video)", () => {
|
||||
it("runs a multi-step video pipeline and returns a downloadable result", async () => {
|
||||
const { body, contentType } = createMultipartPayload([
|
||||
{ name: "file", filename: "tiny.mp4", content: TINY_MP4, contentType: "video/mp4" },
|
||||
{
|
||||
name: "pipeline",
|
||||
content: JSON.stringify({
|
||||
steps: [
|
||||
{ toolId: "rotate-video", settings: { transform: "cw90" } },
|
||||
{ toolId: "mute-video", settings: {} },
|
||||
],
|
||||
}),
|
||||
},
|
||||
]);
|
||||
|
||||
const res = await app.inject({
|
||||
method: "POST",
|
||||
url: "/api/v1/pipeline/execute",
|
||||
headers: { "content-type": contentType, authorization: `Bearer ${adminToken}` },
|
||||
body,
|
||||
});
|
||||
|
||||
expect(res.statusCode).toBe(200);
|
||||
const json = JSON.parse(res.body);
|
||||
expect(json.downloadUrl).toBeDefined();
|
||||
expect(json.stepsCompleted).toBe(2);
|
||||
|
||||
const dlRes = await app.inject({
|
||||
method: "GET",
|
||||
url: json.downloadUrl,
|
||||
headers: { authorization: `Bearer ${adminToken}` },
|
||||
});
|
||||
expect(dlRes.statusCode).toBe(200);
|
||||
expect(dlRes.rawPayload.length).toBeGreaterThan(0);
|
||||
}, 60_000);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user