fix(pi): validate user-entry conversation forks
This commit is contained in:
@@ -169,14 +169,38 @@ describe('CodingConversationTimeline', () => {
|
||||
const snapshot = {
|
||||
...base,
|
||||
nodes: [
|
||||
{
|
||||
kind: 'message' as const,
|
||||
id: 'message-user-feature',
|
||||
sourceEntryId: 'entry-user-feature',
|
||||
role: 'user' as const,
|
||||
status: 'complete' as const,
|
||||
blocks: [{ kind: 'text' as const, id: 'text-user-feature', text: 'Build it', status: 'complete' as const }],
|
||||
},
|
||||
{
|
||||
kind: 'message' as const,
|
||||
id: 'message-feature',
|
||||
sourceEntryId: 'entry-feature',
|
||||
sourceEntryId: 'entry-assistant-feature',
|
||||
role: 'assistant' as const,
|
||||
status: 'complete' as const,
|
||||
blocks: [{ kind: 'text' as const, id: 'text-feature', text: 'Ready', status: 'complete' as const }],
|
||||
},
|
||||
{
|
||||
kind: 'message' as const,
|
||||
id: 'message-optimistic-feature',
|
||||
sourceEntryId: 'entry-optimistic-feature',
|
||||
clientRequestId: 'request-optimistic-feature',
|
||||
role: 'user' as const,
|
||||
status: 'optimistic' as const,
|
||||
blocks: [{ kind: 'text' as const, id: 'text-optimistic-feature', text: 'Pending', status: 'complete' as const }],
|
||||
},
|
||||
{
|
||||
kind: 'message' as const,
|
||||
id: 'message-without-entry-feature',
|
||||
role: 'user' as const,
|
||||
status: 'complete' as const,
|
||||
blocks: [{ kind: 'text' as const, id: 'text-without-entry-feature', text: 'Local only', status: 'complete' as const }],
|
||||
},
|
||||
{
|
||||
kind: 'tool' as const,
|
||||
id: 'tool-feature',
|
||||
@@ -249,8 +273,10 @@ describe('CodingConversationTimeline', () => {
|
||||
|
||||
render(<CodingConversationTimeline conversationId="conversation-feature-ui" onFork={onFork} />);
|
||||
|
||||
fireEvent.click(screen.getByRole('button', { name: '从这里创建新对话分支' }));
|
||||
expect(onFork).toHaveBeenCalledWith('entry-feature');
|
||||
const forkActions = screen.getAllByRole('button', { name: '从这里创建新对话分支' });
|
||||
expect(forkActions).toHaveLength(1);
|
||||
fireEvent.click(forkActions[0]!);
|
||||
expect(onFork).toHaveBeenCalledWith('entry-user-feature');
|
||||
expect(screen.getByText('并行子任务')).toBeInTheDocument();
|
||||
expect(screen.getByText('单个子任务')).toBeInTheDocument();
|
||||
expect(screen.getByText('串行子任务')).toBeInTheDocument();
|
||||
|
||||
Reference in New Issue
Block a user