Skip to content

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

test(goal-tool-line): add test file for GoalToolLine component

Steven Enamakel08eb9550b698
diff --git a/app/src/features/conversations/aui/GoalToolLine.test.tsx b/app/src/features/conversations/aui/GoalToolLine.test.tsx
new file mode 100644
index 0000000000..802da98618
--- /dev/null
+++ b/app/src/features/conversations/aui/GoalToolLine.test.tsx
@@ -0,0 +1,53 @@
+import { render, screen } from '@testing-library/react';
+import { describe, expect, it } from 'vitest';
+
+import { GoalToolLine } from './GoalToolLine';
+
+const baseProps = {
+ type: 'tool-call' as const,
+ toolName: 'goal_set',
+ toolCallId: 'call-1',
+ argsText: '{}',
+ addResult: () => {},
+ resume: () => {},
+ respondToApproval: async () => {},
+};
+
+describe('GoalToolLine', () => {
+ it('renders "{objective} ({status})" from the result payload', () => {
+ render(
+ <GoalToolLine
+ {...baseProps}
+ args={{} as never}
+ result={{ goal: { objective: 'Ship the feature', status: 'active' } } as never}
+ status={{ type: 'complete' }}
+ />
+ );
+ expect(screen.getByText('Ship the feature (active)')).toBeInTheDocument();
+ });
+
+ it('falls back to args while the call is still in flight', () => {
+ render(
+ <GoalToolLine
+ {...baseProps}
+ args={{ goal: { objective: 'Ship the feature', status: 'active' } } as never}
+ result={undefined}
+ status={{ type: 'running' }}
+ />
+ );
+ expect(screen.getByText('Ship the feature (active)')).toBeInTheDocument();
+ });
+
+ it('renders nothing for a cleared goal (goal_get with no goal)', () => {
+ const { container } = render(
+ <GoalToolLine
+ {...baseProps}
+ toolName="goal_get"
+ args={{} as never}
+ result={{ goal: null } as never}
+ status={{ type: 'complete' }}
+ />
+ );
+ expect(container).toBeEmptyDOMElement();
+ });
+});