mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-26 09:19:43 +00:00
Fix all unknown slot props are serialised (#732)
Ensures only specified properties are cloned for serialisation.
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import { describe, expect, it } from "vitest"
|
||||
|
||||
import { INodeInputSlot, INodeOutputSlot } from "@/interfaces"
|
||||
import { serializeSlot } from "@/NodeSlot"
|
||||
import { inputAsSerialisable, outputAsSerialisable } from "@/NodeSlot"
|
||||
|
||||
describe("NodeSlot", () => {
|
||||
describe("serializeSlot", () => {
|
||||
describe("inputAsSerialisable", () => {
|
||||
it("removes _data from serialized slot", () => {
|
||||
const slot: INodeOutputSlot = {
|
||||
_data: "test data",
|
||||
@@ -12,7 +12,7 @@ describe("NodeSlot", () => {
|
||||
type: "STRING",
|
||||
links: [],
|
||||
}
|
||||
const serialized = serializeSlot(slot)
|
||||
const serialized = outputAsSerialisable(slot)
|
||||
expect(serialized).not.toHaveProperty("_data")
|
||||
})
|
||||
|
||||
@@ -32,7 +32,7 @@ describe("NodeSlot", () => {
|
||||
},
|
||||
}
|
||||
|
||||
const serialized = serializeSlot(widgetInputSlot)
|
||||
const serialized = inputAsSerialisable(widgetInputSlot)
|
||||
expect(serialized).not.toHaveProperty("pos")
|
||||
})
|
||||
|
||||
@@ -43,7 +43,7 @@ describe("NodeSlot", () => {
|
||||
pos: [10, 20],
|
||||
link: null,
|
||||
}
|
||||
const serialized = serializeSlot(normalSlot)
|
||||
const serialized = inputAsSerialisable(normalSlot)
|
||||
expect(serialized).toHaveProperty("pos")
|
||||
})
|
||||
|
||||
@@ -62,7 +62,7 @@ describe("NodeSlot", () => {
|
||||
},
|
||||
}
|
||||
|
||||
const serialized = serializeSlot(widgetInputSlot)
|
||||
const serialized = inputAsSerialisable(widgetInputSlot)
|
||||
expect(serialized.widget).toEqual({ name: "test-widget" })
|
||||
expect(serialized.widget).not.toHaveProperty("type")
|
||||
expect(serialized.widget).not.toHaveProperty("value")
|
||||
|
||||
Reference in New Issue
Block a user