mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
feat(tools): 2.0 phase 5 wave 2 - pdf depth (21 tools) (#220)
This commit is contained in:
@@ -357,6 +357,98 @@ describe("Save pipeline edge cases", () => {
|
||||
});
|
||||
});
|
||||
|
||||
// ═══════════════════════════════════════════════════════════════════════════
|
||||
// PASSWORD TOOL PIPELINE SAVE REJECTION
|
||||
// ═══════════════════════════════════════════════════════════════════════════
|
||||
describe("Pipeline save rejects password tools", () => {
|
||||
it("rejects saving a pipeline containing protect-pdf", async () => {
|
||||
const res = await app.inject({
|
||||
method: "POST",
|
||||
url: "/api/v1/pipeline/save",
|
||||
headers: {
|
||||
"content-type": "application/json",
|
||||
authorization: `Bearer ${adminToken}`,
|
||||
},
|
||||
payload: {
|
||||
name: "protect-pipeline",
|
||||
steps: [
|
||||
{ toolId: "resize", settings: { width: 100 } },
|
||||
{ toolId: "protect-pdf", settings: { userPassword: "test" } },
|
||||
],
|
||||
},
|
||||
});
|
||||
|
||||
expect(res.statusCode).toBe(400);
|
||||
const json = JSON.parse(res.body);
|
||||
expect(json.error).toMatch(/password/i);
|
||||
});
|
||||
|
||||
it("rejects saving a pipeline containing unlock-pdf", async () => {
|
||||
const res = await app.inject({
|
||||
method: "POST",
|
||||
url: "/api/v1/pipeline/save",
|
||||
headers: {
|
||||
"content-type": "application/json",
|
||||
authorization: `Bearer ${adminToken}`,
|
||||
},
|
||||
payload: {
|
||||
name: "unlock-pipeline",
|
||||
steps: [{ toolId: "unlock-pdf", settings: { password: "test" } }],
|
||||
},
|
||||
});
|
||||
|
||||
expect(res.statusCode).toBe(400);
|
||||
const json = JSON.parse(res.body);
|
||||
expect(json.error).toMatch(/password/i);
|
||||
});
|
||||
});
|
||||
|
||||
// ═══════════════════════════════════════════════════════════════════════════
|
||||
// PIPELINE EXECUTE REJECTS PASSWORD TOOLS
|
||||
// ═══════════════════════════════════════════════════════════════════════════
|
||||
describe("Pipeline execute rejects password tools", () => {
|
||||
it("rejects executing a pipeline containing protect-pdf", async () => {
|
||||
const res = await executePipeline(PNG_200x150, "test.png", {
|
||||
steps: [
|
||||
{ toolId: "resize", settings: { width: 100 } },
|
||||
{ toolId: "protect-pdf", settings: { userPassword: "test" } },
|
||||
],
|
||||
});
|
||||
|
||||
expect(res.statusCode).toBe(400);
|
||||
const json = JSON.parse(res.body);
|
||||
expect(json.error).toMatch(/password/i);
|
||||
});
|
||||
});
|
||||
|
||||
// ═══════════════════════════════════════════════════════════════════════════
|
||||
// PIPELINE BATCH REJECTS PASSWORD TOOLS
|
||||
// ═══════════════════════════════════════════════════════════════════════════
|
||||
describe("Pipeline batch rejects password tools", () => {
|
||||
it("rejects a batch pipeline containing unlock-pdf", async () => {
|
||||
const { body, contentType } = createMultipartPayload([
|
||||
{ name: "file", filename: "test.png", contentType: "image/png", content: PNG_200x150 },
|
||||
{
|
||||
name: "pipeline",
|
||||
content: JSON.stringify({
|
||||
steps: [{ toolId: "unlock-pdf", settings: { password: "test" } }],
|
||||
}),
|
||||
},
|
||||
]);
|
||||
|
||||
const res = await app.inject({
|
||||
method: "POST",
|
||||
url: "/api/v1/pipeline/batch",
|
||||
headers: { "content-type": contentType, authorization: `Bearer ${adminToken}` },
|
||||
body,
|
||||
});
|
||||
|
||||
expect(res.statusCode).toBe(400);
|
||||
const json = JSON.parse(res.body);
|
||||
expect(json.error).toMatch(/password/i);
|
||||
});
|
||||
});
|
||||
|
||||
// ═══════════════════════════════════════════════════════════════════════════
|
||||
// DELETE PIPELINE EDGE CASES
|
||||
// ═══════════════════════════════════════════════════════════════════════════
|
||||
|
||||
Reference in New Issue
Block a user