test(workflow): avoid unbound view builder reference
This commit is contained in:
@@ -227,13 +227,12 @@ describe('workflow-run Conversation Definition', () => {
|
|||||||
const unrelated = matched(at(3, 'turn/start', { turn: 1 }), 'update')
|
const unrelated = matched(at(3, 'turn/start', { turn: 1 }), 'update')
|
||||||
expect(workflowRunDefinition.update(updateContext, unrelated)).toBe(state)
|
expect(workflowRunDefinition.update(updateContext, unrelated)).toBe(state)
|
||||||
expect(workflowRunDefinition.target).toBe('chat')
|
expect(workflowRunDefinition.target).toBe('chat')
|
||||||
const buildViewNode = workflowRunDefinition.buildViewNode
|
expect(workflowRunDefinition.buildViewNode?.({
|
||||||
if (buildViewNode === undefined) throw new Error('expected workflow Chat view builder')
|
|
||||||
expect(buildViewNode({
|
|
||||||
...updateContext, matches: [], start: undefined,
|
...updateContext, matches: [], start: undefined,
|
||||||
})).toBeNull()
|
})).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 === 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.kind).toBe('workflow-run')
|
||||||
expect((directNode.data as WorkflowRunChatData).status).toBe('running')
|
expect((directNode.data as WorkflowRunChatData).status).toBe('running')
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user