Files
ComfyUI_frontend/test/NodeSlot.test.ts
filtered 6224d2dc06 [Cleanup] Update ESLint rules with stricter auto-fixes (#614)
Stylistic plugin falls short in a few areas when it comes to consistent
lists and chaining. Replaced some key rules with antfu's personal
variants.

`eslint` can now be run repo-wide without params.
2025-02-26 11:12:03 +00:00

51 lines
1.3 KiB
TypeScript

import { describe, expect, it } from "vitest"
import { INodeInputSlot, INodeOutputSlot } from "@/interfaces"
import { serializeSlot } from "@/NodeSlot"
describe("NodeSlot", () => {
describe("serializeSlot", () => {
it("removes _data from serialized slot", () => {
const slot: INodeOutputSlot = {
_data: "test data",
name: "test-id",
type: "STRING",
links: [],
}
const serialized = serializeSlot(slot)
expect(serialized).not.toHaveProperty("_data")
})
it("removes pos from widget input slots", () => {
const widgetInputSlot: INodeInputSlot = {
name: "test-id",
pos: [10, 20],
type: "STRING",
link: null,
widget: {
name: "test-widget",
type: "combo",
value: "test-value-1",
options: {
values: ["test-value-1", "test-value-2"],
},
},
}
const serialized = serializeSlot(widgetInputSlot)
expect(serialized).not.toHaveProperty("pos")
})
it("preserves pos for non-widget input slots", () => {
const normalSlot: INodeInputSlot = {
name: "test-id",
type: "STRING",
pos: [10, 20],
link: null,
}
const serialized = serializeSlot(normalSlot)
expect(serialized).toHaveProperty("pos")
})
})
})