mirror of
https://github.com/stablyai/orca.git
synced 2026-09-22 08:02:28 +00:00
test(native-chat): split structured question fixtures
This commit is contained in:
@@ -7,6 +7,10 @@ import type { AgentJournalRenderItem } from '../../../../shared/agent-session-jo
|
||||
import type { AgentSessionBackgroundTask } from '../../../../shared/agent-session-wire'
|
||||
import { decodeAgentSessionQuestionAnswers } from '../../../../shared/agent-session-question-answer'
|
||||
import type { NativeChatQuestionCardProps } from './NativeChatQuestionCard'
|
||||
import {
|
||||
claudeGroupedQuestionPromptItems,
|
||||
legacySingleQuestionPromptItems
|
||||
} from './native-chat-structured-question-test-fixtures'
|
||||
|
||||
const mocks = vi.hoisted(() => ({
|
||||
call: vi.fn(),
|
||||
@@ -800,46 +804,7 @@ describe('NativeChatStructuredSession', () => {
|
||||
}, 30000)
|
||||
|
||||
it('passes Claude grouped questions and one shared answer through the card', () => {
|
||||
mocks.promptItems = [
|
||||
{
|
||||
itemId: 'question-item',
|
||||
revision: 1,
|
||||
sequence: 1,
|
||||
observedAt: 1,
|
||||
body: {
|
||||
kind: 'question',
|
||||
question: '2 grouped questions from Claude',
|
||||
options: [],
|
||||
questions: [
|
||||
{
|
||||
id: 'q1',
|
||||
header: 'Targets',
|
||||
question: 'Which targets?',
|
||||
multiSelect: true,
|
||||
options: [
|
||||
{ id: 'target-web', label: 'Web' },
|
||||
{ id: 'target-mobile', label: 'Mobile' }
|
||||
],
|
||||
freeTextQuestionId: 'q1'
|
||||
},
|
||||
{
|
||||
id: 'q2',
|
||||
header: 'Host',
|
||||
question: 'Where should it run?',
|
||||
multiSelect: false,
|
||||
options: [],
|
||||
freeTextQuestionId: 'q2'
|
||||
}
|
||||
],
|
||||
resolution: {
|
||||
state: 'pending',
|
||||
selectedOptionId: null,
|
||||
resolvedBy: null,
|
||||
resolvedAt: null
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
mocks.promptItems = claudeGroupedQuestionPromptItems
|
||||
|
||||
render(
|
||||
<NativeChatStructuredSession
|
||||
@@ -876,29 +841,7 @@ describe('NativeChatStructuredSession', () => {
|
||||
})
|
||||
|
||||
it('keeps legacy single-question option ids and free text behavior', () => {
|
||||
mocks.promptItems = [
|
||||
{
|
||||
itemId: 'legacy-question-item',
|
||||
revision: 1,
|
||||
sequence: 1,
|
||||
observedAt: 1,
|
||||
body: {
|
||||
kind: 'question',
|
||||
question: 'Pick a library',
|
||||
options: [
|
||||
{ id: 'q1:choice-1', label: 'React' },
|
||||
{ id: 'q1:choice-2', label: 'Vue' }
|
||||
],
|
||||
freeTextQuestionId: 'q1',
|
||||
resolution: {
|
||||
state: 'pending',
|
||||
selectedOptionId: null,
|
||||
resolvedBy: null,
|
||||
resolvedAt: null
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
mocks.promptItems = legacySingleQuestionPromptItems
|
||||
|
||||
render(
|
||||
<NativeChatStructuredSession
|
||||
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
import type { AgentJournalRenderItem } from '../../../../shared/agent-session-journal-types'
|
||||
|
||||
export const claudeGroupedQuestionPromptItems: AgentJournalRenderItem[] = [
|
||||
{
|
||||
itemId: 'question-item',
|
||||
revision: 1,
|
||||
sequence: 1,
|
||||
observedAt: 1,
|
||||
body: {
|
||||
kind: 'question',
|
||||
question: '2 grouped questions from Claude',
|
||||
options: [],
|
||||
questions: [
|
||||
{
|
||||
id: 'q1',
|
||||
header: 'Targets',
|
||||
question: 'Which targets?',
|
||||
multiSelect: true,
|
||||
options: [
|
||||
{ id: 'target-web', label: 'Web' },
|
||||
{ id: 'target-mobile', label: 'Mobile' }
|
||||
],
|
||||
freeTextQuestionId: 'q1'
|
||||
},
|
||||
{
|
||||
id: 'q2',
|
||||
header: 'Host',
|
||||
question: 'Where should it run?',
|
||||
multiSelect: false,
|
||||
options: [],
|
||||
freeTextQuestionId: 'q2'
|
||||
}
|
||||
],
|
||||
resolution: {
|
||||
state: 'pending',
|
||||
selectedOptionId: null,
|
||||
resolvedBy: null,
|
||||
resolvedAt: null
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
export const legacySingleQuestionPromptItems: AgentJournalRenderItem[] = [
|
||||
{
|
||||
itemId: 'legacy-question-item',
|
||||
revision: 1,
|
||||
sequence: 1,
|
||||
observedAt: 1,
|
||||
body: {
|
||||
kind: 'question',
|
||||
question: 'Pick a library',
|
||||
options: [
|
||||
{ id: 'q1:choice-1', label: 'React' },
|
||||
{ id: 'q1:choice-2', label: 'Vue' }
|
||||
],
|
||||
freeTextQuestionId: 'q1',
|
||||
resolution: {
|
||||
state: 'pending',
|
||||
selectedOptionId: null,
|
||||
resolvedBy: null,
|
||||
resolvedAt: null
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user