|
|
|
@ -17,6 +17,7 @@ import { |
|
|
|
POPI_VIDEO_SUBTYPES, |
|
|
|
} from "@/constants/generationTask"; |
|
|
|
import type { WorkflowNode, WorkflowEdge } from "@/types"; |
|
|
|
import { executeDerivedImage } from "../execution/derivedImageExecutor"; |
|
|
|
|
|
|
|
// Mock the Toast hook
|
|
|
|
vi.mock("@/components/Toast", () => ({ |
|
|
|
@ -39,6 +40,14 @@ vi.mock("@/utils/logger", () => ({ |
|
|
|
}, |
|
|
|
})); |
|
|
|
|
|
|
|
vi.mock("../execution/derivedImageExecutor", async (importOriginal) => { |
|
|
|
const actual = await importOriginal<typeof import("../execution/derivedImageExecutor")>(); |
|
|
|
return { |
|
|
|
...actual, |
|
|
|
executeDerivedImage: vi.fn().mockResolvedValue(undefined), |
|
|
|
}; |
|
|
|
}); |
|
|
|
|
|
|
|
vi.mock("@/lib/popiartTask/runTask", () => ({ |
|
|
|
runPopiartTask: ({ payload, headers, signal }: { |
|
|
|
payload: { mediaType?: string }; |
|
|
|
@ -1914,6 +1923,70 @@ describe("workflowStore integration tests", () => { |
|
|
|
}); |
|
|
|
|
|
|
|
describe("Group operations with non-standard node types", () => { |
|
|
|
it("skips smart image auto task nodes when running a group", async () => { |
|
|
|
useWorkflowStore.setState({ |
|
|
|
nodes: [ |
|
|
|
{ ...createTestNode("prompt-1", "prompt", { prompt: "old" }), groupId: "group-1" }, |
|
|
|
{ |
|
|
|
...createTestNode("crop-1", "smartImage", { |
|
|
|
status: "idle", |
|
|
|
derivedImage: { |
|
|
|
sourceNodeId: "source-1", |
|
|
|
operation: "crop", |
|
|
|
task: { |
|
|
|
cropRect: { x: 0, y: 0, width: 100, height: 100 }, |
|
|
|
outputWidth: 100, |
|
|
|
outputHeight: 100, |
|
|
|
aspectRatio: "1:1", |
|
|
|
}, |
|
|
|
}, |
|
|
|
}), |
|
|
|
groupId: "group-1", |
|
|
|
}, |
|
|
|
{ |
|
|
|
...createTestNode("split-1", "smartImage", { |
|
|
|
status: "idle", |
|
|
|
derivedImage: { |
|
|
|
sourceNodeId: "source-1", |
|
|
|
operation: "splitGrid", |
|
|
|
task: { rows: 2, cols: 2, row: 1, col: 1, cellKey: "1-1" }, |
|
|
|
}, |
|
|
|
}), |
|
|
|
groupId: "group-1", |
|
|
|
}, |
|
|
|
{ |
|
|
|
...createTestNode("angle-1", "smartImage", { |
|
|
|
status: "idle", |
|
|
|
derivedImage: { |
|
|
|
sourceNodeId: "source-1", |
|
|
|
operation: "multiAngle", |
|
|
|
task: { horizontal: 0, vertical: 0, zoom: 1 }, |
|
|
|
}, |
|
|
|
}), |
|
|
|
groupId: "group-1", |
|
|
|
}, |
|
|
|
], |
|
|
|
edges: [], |
|
|
|
groups: { |
|
|
|
"group-1": { |
|
|
|
id: "group-1", |
|
|
|
name: "Group 1", |
|
|
|
color: "neutral", |
|
|
|
position: { x: 0, y: 0 }, |
|
|
|
size: { width: 600, height: 400 }, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}); |
|
|
|
|
|
|
|
await useWorkflowStore.getState().runGroup("group-1"); |
|
|
|
|
|
|
|
expect(executeDerivedImage).not.toHaveBeenCalled(); |
|
|
|
expect(useWorkflowStore.getState().nodes.find((node) => node.id === "prompt-1")?.data.prompt) |
|
|
|
.toBe("old"); |
|
|
|
expect(useWorkflowStore.getState().runningNodeIds.size).toBe(0); |
|
|
|
expect(useWorkflowStore.getState().runningGroupIds.size).toBe(0); |
|
|
|
}); |
|
|
|
|
|
|
|
describe("createGroup bounding box calculation", () => { |
|
|
|
it("should correctly calculate bounding box for easeCurve nodes (340x280)", () => { |
|
|
|
useWorkflowStore.setState({ |
|
|
|
|