From 8e3418e925ecc4ca7992b64d924201969b370863 Mon Sep 17 00:00:00 2001 From: pku-xht Date: Tue, 11 Aug 2026 18:41:10 +0800 Subject: [PATCH] test(workflow): avoid unbound view builder reference --- .../client/ui-workflow-run/tests/workflow-run.spec.tsx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/client/ui-workflow-run/tests/workflow-run.spec.tsx b/packages/client/ui-workflow-run/tests/workflow-run.spec.tsx index 308de0a2a8..667eabe903 100644 --- a/packages/client/ui-workflow-run/tests/workflow-run.spec.tsx +++ b/packages/client/ui-workflow-run/tests/workflow-run.spec.tsx @@ -227,13 +227,12 @@ describe('workflow-run Conversation Definition', () => { const unrelated = matched(at(3, 'turn/start', { turn: 1 }), 'update') expect(workflowRunDefinition.update(updateContext, unrelated)).toBe(state) expect(workflowRunDefinition.target).toBe('chat') - const buildViewNode = workflowRunDefinition.buildViewNode - if (buildViewNode === undefined) throw new Error('expected workflow Chat view builder') - expect(buildViewNode({ + expect(workflowRunDefinition.buildViewNode?.({ ...updateContext, matches: [], start: undefined, })).toBeNull() - const directNode = buildViewNode(updateContext) as ChatConversationViewNode | null + const directNode = workflowRunDefinition.buildViewNode?.(updateContext) as ChatConversationViewNode | null | undefined if (directNode === null) throw new Error('expected direct workflow Chat node') + if (directNode === undefined) throw new Error('expected workflow Chat view builder') expect(directNode.kind).toBe('workflow-run') expect((directNode.data as WorkflowRunChatData).status).toBe('running') })