mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-07-10 09:07:54 +00:00
## Summary Adds a branded local `NodeId` helper and starts separating local node identity from serialized workflow IDs. ## Changes - **What**: Adds central `NodeId` parsing/branding helpers, migrates nearby widget identity types, keeps queue results at the serialized boundary, and removes misleading workflow `NodeId` usage from execution error maps. ## Review Focus Check that the first migration slice keeps serialized/API IDs as raw `number | string` while local UI/store IDs use the branded string type. ## Caveat `SUBGRAPH_INPUT_ID` and `SUBGRAPH_OUTPUT_ID` are now branded local `NodeId` string values internally instead of numeric sentinels. Reviewers should double-check extension compatibility for callers that import `Constants` and compare those values numerically. ## Screenshots (if applicable) N/A --------- Co-authored-by: GitHub Action <action@github.com> Co-authored-by: AustinMroz <austin@comfy.org> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
51 lines
1.6 KiB
TypeScript
51 lines
1.6 KiB
TypeScript
import { render } from '@testing-library/vue'
|
|
import { describe, expect, it, vi } from 'vitest'
|
|
import { defineComponent, h, ref } from 'vue'
|
|
|
|
import { toNodeId } from '@/types/nodeId'
|
|
|
|
const lastProps = ref<Record<string, unknown> | null>(null)
|
|
|
|
vi.mock('@/components/load3d/Load3D.vue', () => ({
|
|
default: defineComponent({
|
|
name: 'Load3D',
|
|
props: {
|
|
widget: { type: null, required: false, default: undefined },
|
|
nodeId: { type: null, required: false, default: undefined },
|
|
canUseRecording: { type: Boolean, default: true },
|
|
canUseHdri: { type: Boolean, default: true },
|
|
canUseBackgroundImage: { type: Boolean, default: true }
|
|
},
|
|
setup(props: Record<string, unknown>) {
|
|
lastProps.value = { ...props }
|
|
return () => h('div', { 'data-testid': 'load3d-stub' })
|
|
}
|
|
})
|
|
}))
|
|
|
|
import Load3DAdvanced from '@/components/load3d/Load3DAdvanced.vue'
|
|
|
|
describe('Load3DAdvanced', () => {
|
|
it('renders the inner Load3D with all expressive features disabled', () => {
|
|
const MOCK_NODE = { id: 'node', type: 'Load3DAdvanced' }
|
|
render(Load3DAdvanced, {
|
|
props: {
|
|
widget: { node: MOCK_NODE } as never
|
|
}
|
|
})
|
|
expect(lastProps.value).toMatchObject({
|
|
canUseRecording: false,
|
|
canUseHdri: false,
|
|
canUseBackgroundImage: false
|
|
})
|
|
})
|
|
|
|
it('forwards widget and nodeId to the inner Load3D', () => {
|
|
const nodeId = toNodeId('a')
|
|
const widget = { node: { id: 'a', type: 'Load3DAdvanced' } }
|
|
render(Load3DAdvanced, { props: { widget: widget as never, nodeId } })
|
|
expect(lastProps.value?.widget).toEqual(widget)
|
|
expect(lastProps.value?.nodeId).toBe(nodeId)
|
|
})
|
|
})
|