|
|
@ -232,6 +232,45 @@ describe("executeNanoBanana", () => { |
|
|
expect((completeCall![1] as Record<string, unknown>).outputImage).toBe("data:image/png;base64,result"); |
|
|
expect((completeCall![1] as Record<string, unknown>).outputImage).toBe("data:image/png;base64,result"); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
it("should keep generated image data in node carousel history for immediate switching", async () => { |
|
|
|
|
|
const node = makeNode(); |
|
|
|
|
|
mockFetch.mockResolvedValueOnce({ |
|
|
|
|
|
ok: true, |
|
|
|
|
|
json: () => Promise.resolve({ success: true, image: "data:image/png;base64,result" }), |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
const ctx = makeCtx(node); |
|
|
|
|
|
await executeNanoBanana(ctx); |
|
|
|
|
|
|
|
|
|
|
|
const completeCall = (ctx.updateNodeData as ReturnType<typeof vi.fn>).mock.calls.find( |
|
|
|
|
|
(c: unknown[]) => (c[1] as Record<string, unknown>).status === "complete" |
|
|
|
|
|
); |
|
|
|
|
|
expect(completeCall?.[1]).toMatchObject({ |
|
|
|
|
|
imageHistory: [ |
|
|
|
|
|
expect.objectContaining({ |
|
|
|
|
|
image: "data:image/png;base64,result", |
|
|
|
|
|
}), |
|
|
|
|
|
], |
|
|
|
|
|
}); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
it("should not call server save-generation for browser-local generation paths", async () => { |
|
|
|
|
|
const node = makeNode(); |
|
|
|
|
|
mockFetch.mockResolvedValueOnce({ |
|
|
|
|
|
ok: true, |
|
|
|
|
|
json: () => Promise.resolve({ success: true, image: "data:image/png;base64,result" }), |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
const ctx = makeCtx(node, { |
|
|
|
|
|
generationsPath: "browserfs://root/project/generations", |
|
|
|
|
|
}); |
|
|
|
|
|
await executeNanoBanana(ctx); |
|
|
|
|
|
|
|
|
|
|
|
expect(mockFetch).toHaveBeenCalledTimes(1); |
|
|
|
|
|
expect(mockFetch).toHaveBeenCalledWith("/api/generate", expect.anything()); |
|
|
|
|
|
expect(ctx.trackSaveGeneration).not.toHaveBeenCalled(); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
it("should add to global history on success", async () => { |
|
|
it("should add to global history on success", async () => { |
|
|
const node = makeNode(); |
|
|
const node = makeNode(); |
|
|
mockFetch.mockResolvedValueOnce({ |
|
|
mockFetch.mockResolvedValueOnce({ |
|
|
|