The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
fix(composer): handle empty message queue in test
Steven Enamakel368011d8929c
diff --git a/app/src/features/conversations/aui/ComposerMessageQueue.test.tsx b/app/src/features/conversations/aui/ComposerMessageQueue.test.tsxnew file mode 100644index 0000000000..b3d6ccd5c2--- /dev/null+++ b/app/src/features/conversations/aui/ComposerMessageQueue.test.tsx@@ -0,0 +1,69 @@+import {+ AssistantRuntimeProvider,+ type ExternalThreadQueueAdapter,+ type ThreadMessageLike,+ useExternalStoreRuntime,+} from '@assistant-ui/react';+import { fireEvent, render, screen } from '@testing-library/react';+import { describe, expect, it, vi } from 'vitest';++import type { RunQueueItem } from '../../../store/queueSlice';+import { ComposerMessageQueue } from './ComposerMessageQueue';+import { buildOpenHumanQueueAdapter } from './queueAdapter';++const TRANSCRIPT: ThreadMessageLike[] = [+ { role: 'user', content: 'older question' },+ { role: 'assistant', content: 'older answer' },+ { role: 'user', content: 'summarise the launch plan' },+];++function Harness({ queue }: { queue: ExternalThreadQueueAdapter }) {+ const runtime = useExternalStoreRuntime({+ messages: TRANSCRIPT,+ isRunning: true,+ convertMessage: (m: ThreadMessageLike) => m,+ onNew: async () => {},+ queue,+ });+ return (+ <AssistantRuntimeProvider runtime={runtime}>+ <ComposerMessageQueue />+ </AssistantRuntimeProvider>+ );+}++function renderWith(items: RunQueueItem[], remove = vi.fn()) {+ const queue = buildOpenHumanQueueAdapter({ items, send: vi.fn(), remove });+ render(<Harness queue={queue} />);+ return { remove };+}++describe('ComposerMessageQueue', () => {+ it('renders nothing while the queue is empty', () => {+ renderWith([]);+ expect(screen.queryByTestId('queued-followups')).not.toBeInTheDocument();+ });++ it('shows the running prompt and each queued message, with translated captions', () => {+ renderWith([+ { id: 'q1', lane: null, textPreview: 'and the pricing?' },+ { id: 'q2', lane: null, textPreview: 'and the timeline' },+ ]);++ const strip = screen.getByTestId('queued-followups');+ expect(strip).toHaveTextContent('summarise the launch plan');+ expect(strip).toHaveTextContent('and the pricing?');+ expect(strip).toHaveTextContent('and the timeline');+ expect(strip).toHaveTextContent('2 queued');+ expect(strip).toHaveTextContent('sends when this finishes');+ expect(strip).toHaveTextContent('running');+ });++ it('removes an item through the runtime queue', () => {+ const { remove } = renderWith([{ id: 'q1', lane: null, textPreview: 'drop me' }]);++ fireEvent.click(screen.getByRole('button', { name: 'Remove "drop me" from the queue' }));++ expect(remove).toHaveBeenCalledWith('q1');+ });+});