Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(conversations): correct test for media and document calls

Steven Enamakel9404200aec1e
diff --git a/app/src/features/conversations/aui/MediaAndDocumentCalls.test.tsx b/app/src/features/conversations/aui/MediaAndDocumentCalls.test.tsx
index 0f13952866..af900e790d 100644
--- a/app/src/features/conversations/aui/MediaAndDocumentCalls.test.tsx
+++ b/app/src/features/conversations/aui/MediaAndDocumentCalls.test.tsx
@@ -74,13 +74,15 @@ describe('MediaGenerationCall', () => {
describe('DocumentArtifactCall', () => {
it('shows the artifact card generating while the tool runs', () => {
render(
- <DocumentArtifactCall
- {...baseProps}
- toolName="generate_document"
- args={{ title: 'Q3 report' } as never}
- result={undefined}
- status={{ type: 'running' }}
- />
+ withStore(
+ <DocumentArtifactCall
+ {...baseProps}
+ toolName="generate_document"
+ args={{ title: 'Q3 report' } as never}
+ result={undefined}
+ status={{ type: 'running' }}
+ />
+ )
);
expect(screen.getByText('Q3 report')).toBeInTheDocument();
@@ -89,16 +91,75 @@ describe('DocumentArtifactCall', () => {
it('shows the settled artifact once generation completes', () => {
render(
- <DocumentArtifactCall
- {...baseProps}
- toolName="generate_presentation"
- args={{} as never}
- result={{ title: 'Board deck', path: '/artifacts/board-deck.pptx' } as never}
- status={{ type: 'complete' }}
- />
+ withStore(
+ <DocumentArtifactCall
+ {...baseProps}
+ toolName="generate_presentation"
+ args={{} as never}
+ result={{ title: 'Board deck', path: '/artifacts/board-deck.pptx' } as never}
+ status={{ type: 'complete' }}
+ />
+ )
);
expect(screen.getByText('Board deck')).toBeInTheDocument();
expect(screen.getByText('/artifacts/board-deck.pptx')).toBeInTheDocument();
});
+
+ it('renders a failed state + Retry when a failed artifact snapshot matches this toolCallId', async () => {
+ const artifacts: ArtifactSnapshot[] = [
+ {
+ artifactId: 'a-1',
+ kind: 'document',
+ title: 'Report',
+ status: 'failed',
+ error: 'producer crashed',
+ updatedAt: 0,
+ toolCallId: 'call-1',
+ },
+ ];
+ render(
+ withStore(
+ <DocumentArtifactCall
+ {...baseProps}
+ toolName="generate_document"
+ args={{ title: 'Report' } as never}
+ result={{ title: 'Report' } as never}
+ status={{ type: 'complete' }}
+ />,
+ artifacts
+ )
+ );
+
+ const retry = screen.getByRole('button');
+ await userEvent.click(retry);
+ expect(aiRegenerateMock).toHaveBeenCalledWith('a-1', THREAD_ID);
+ });
+
+ it('does not show Retry for a failed artifact belonging to a different call', () => {
+ const artifacts: ArtifactSnapshot[] = [
+ {
+ artifactId: 'a-1',
+ kind: 'document',
+ title: 'Report',
+ status: 'failed',
+ error: 'producer crashed',
+ updatedAt: 0,
+ toolCallId: 'some-other-call',
+ },
+ ];
+ render(
+ withStore(
+ <DocumentArtifactCall
+ {...baseProps}
+ toolName="generate_document"
+ args={{ title: 'Report' } as never}
+ result={{ title: 'Report' } as never}
+ status={{ type: 'complete' }}
+ />,
+ artifacts
+ )
+ );
+ expect(screen.queryByRole('button')).toBeNull();
+ });
});