Skip to content

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

fix(conversations): update ToolFailureCard test to match new error state

Steven Enamakel9f854df4859a
diff --git a/app/src/features/conversations/aui/ToolFailureCard.test.tsx b/app/src/features/conversations/aui/ToolFailureCard.test.tsx
new file mode 100644
index 0000000000..09c59d8728
--- /dev/null
+++ b/app/src/features/conversations/aui/ToolFailureCard.test.tsx
@@ -0,0 +1,35 @@
+import { render, screen } from '@testing-library/react';
+import { describe, expect, it } from 'vitest';
+
+import type { ToolFailureExplanation } from '../../../store/chatRuntimeSlice';
+import { ToolFailureCard } from './ToolFailureCard';
+
+const failure: ToolFailureExplanation = {
+ class: 'MissingPermission',
+ category: 'BlockedByPolicy',
+ recoverable: false,
+ causePlain: 'The app needs calendar access.',
+ nextAction: 'Grant calendar access and try again.',
+};
+
+describe('ToolFailureCard', () => {
+ it('renders the failure through the vendored tool-error element', () => {
+ render(<ToolFailureCard toolName="calendar_create_event" failure={failure} />);
+
+ const card = screen.getByTestId('assistant-ui-tool-failure');
+ expect(card).toHaveTextContent('calendar_create_event');
+ expect(card).toHaveTextContent(/grant calendar access/i);
+ });
+
+ it('falls back to the failure class as the target when none is given', () => {
+ render(<ToolFailureCard toolName="shell" failure={failure} />);
+
+ expect(screen.getByTestId('assistant-ui-tool-failure')).toHaveTextContent('MissingPermission');
+ });
+
+ it('prefers an explicit target over the failure class', () => {
+ render(<ToolFailureCard toolName="shell" target="rm -rf /tmp/x" failure={failure} />);
+
+ expect(screen.getByTestId('assistant-ui-tool-failure')).toHaveTextContent('rm -rf /tmp/x');
+ });
+});