Files
ComfyUI_frontend/src/utils/__tests__/executionErrorTestUtils.ts
huang47 aa38b5f478 test: address review feedback on coverage tests
- Reuse shared litegraph/subgraph test factories instead of hand-rolled mocks
- Seed required_input_missing errors via shared executionErrorTestUtils helper
- Use createTestingPinia in executionErrorStore derived-state tests
- Drop change-detector assertion on the zeroUuid constant
- Replace fromAny/as-unknown-as with fromPartial or honest signatures
  (widen ComfyButtonGroup.insert and loadGraphData to inputs they already handle)
- Isolate ChangeTracker.init prototype/listener side effects per test
- Reset fetchJobs mock implementations and fake timers between tests
2026-07-03 14:45:57 -07:00

33 lines
839 B
TypeScript

import type { NodeError } from '@/schemas/apiSchema'
import type { useExecutionErrorStore } from '@/stores/executionErrorStore'
import type { NodeExecutionId } from '@/types/nodeIdentification'
type ExecutionErrorStore = ReturnType<typeof useExecutionErrorStore>
export function createRequiredInputMissingNodeError(
inputName: string
): NodeError {
return {
errors: [
{
type: 'required_input_missing',
message: 'Missing',
details: '',
extra_info: { input_name: inputName }
}
],
dependent_outputs: [],
class_type: 'TestNode'
}
}
export function seedRequiredInputMissingNodeError(
store: ExecutionErrorStore,
executionId: NodeExecutionId,
inputName: string
): void {
store.lastNodeErrors = {
[executionId]: createRequiredInputMissingNodeError(inputName)
}
}