mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-22 16:25:58 +00:00
test(desktop): satisfy ToolCallMessagePartProps in clarify tests
CI typecheck requires argsText, status, addResult, and resume on rendered tool parts.
This commit is contained in:
parent
192ce05d05
commit
3e9aec9f94
1 changed files with 31 additions and 17 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import { cleanup, render, screen } from '@testing-library/react'
|
||||
import type { ToolCallMessagePartProps } from '@assistant-ui/react'
|
||||
import type { ReactNode } from 'react'
|
||||
import { afterEach, describe, expect, it } from 'vitest'
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||
|
||||
import { I18nProvider } from '@/i18n'
|
||||
|
||||
|
|
@ -18,6 +19,25 @@ function renderClarify(ui: ReactNode) {
|
|||
)
|
||||
}
|
||||
|
||||
function settledClarifyProps(
|
||||
args: ToolCallMessagePartProps['args'],
|
||||
result: ToolCallMessagePartProps['result'],
|
||||
toolCallId: string
|
||||
): ToolCallMessagePartProps {
|
||||
return {
|
||||
addResult: vi.fn(),
|
||||
args,
|
||||
argsText: JSON.stringify(args),
|
||||
isError: false,
|
||||
result,
|
||||
resume: vi.fn(),
|
||||
status: { type: 'complete' },
|
||||
toolCallId,
|
||||
toolName: 'clarify',
|
||||
type: 'tool-call'
|
||||
}
|
||||
}
|
||||
|
||||
describe('readClarifyResult', () => {
|
||||
it('reads question + user_response from the tool JSON payload', () => {
|
||||
expect(
|
||||
|
|
@ -61,16 +81,15 @@ describe('ClarifyTool settled view', () => {
|
|||
it('keeps the question and answer visible after the tool completes', () => {
|
||||
renderClarify(
|
||||
<ClarifyTool
|
||||
args={{ question: 'Which deployment target?', choices: ['staging', 'prod'] }}
|
||||
isError={false}
|
||||
result={{
|
||||
question: 'Which deployment target?',
|
||||
choices_offered: ['staging', 'prod'],
|
||||
user_response: 'staging'
|
||||
}}
|
||||
toolCallId="clarify-1"
|
||||
toolName="clarify"
|
||||
type="tool-call"
|
||||
{...settledClarifyProps(
|
||||
{ question: 'Which deployment target?', choices: ['staging', 'prod'] },
|
||||
{
|
||||
question: 'Which deployment target?',
|
||||
choices_offered: ['staging', 'prod'],
|
||||
user_response: 'staging'
|
||||
},
|
||||
'clarify-1'
|
||||
)}
|
||||
/>
|
||||
)
|
||||
|
||||
|
|
@ -83,12 +102,7 @@ describe('ClarifyTool settled view', () => {
|
|||
it('labels an empty response as Skipped', () => {
|
||||
renderClarify(
|
||||
<ClarifyTool
|
||||
args={{ question: 'Anything else?' }}
|
||||
isError={false}
|
||||
result={{ question: 'Anything else?', user_response: '' }}
|
||||
toolCallId="clarify-2"
|
||||
toolName="clarify"
|
||||
type="tool-call"
|
||||
{...settledClarifyProps({ question: 'Anything else?' }, { question: 'Anything else?', user_response: '' }, 'clarify-2')}
|
||||
/>
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue