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
test(chat): replace withI18n with render in memory chip tests
Steven Enamakelfef2b14d981f
diff --git a/app/src/features/conversations/aui/ChatErrorNotice.test.tsx b/app/src/features/conversations/aui/ChatErrorNotice.test.tsxnew file mode 100644index 0000000000..53149cca4e--- /dev/null+++ b/app/src/features/conversations/aui/ChatErrorNotice.test.tsx@@ -0,0 +1,89 @@+import {+ AssistantRuntimeProvider,+ type ThreadMessageLike,+ useExternalStoreRuntime,+} from '@assistant-ui/react';+import { render, screen } from '@testing-library/react';+import { describe, expect, it } from 'vitest';++import { Thread } from '../../../components/assistant-ui/thread';+import { CHAT_ERROR_METADATA_KEY } from '../../../store/threadSlice';++/**+ * Mirrors `thread.directiveText.test.tsx`'s harness: driven through `Thread`+ * on `useExternalStoreRuntime` (the runtime family `/chat` uses), not the+ * dev demo, so this exercises the real `AssistantMessage` render path where+ * `ChatErrorNotice` is mounted.+ */+function Harness({ messages }: { messages: ThreadMessageLike[] }) {+ const runtime = useExternalStoreRuntime({+ messages,+ isRunning: false,+ convertMessage: (m: ThreadMessageLike) => m,+ onNew: async () => {},+ });+ return (+ <AssistantRuntimeProvider runtime={runtime}>+ <Thread />+ </AssistantRuntimeProvider>+ );+}++const guardrailMessage: ThreadMessageLike = {+ role: 'assistant',+ content: [],+ metadata: {+ custom: {+ extraMetadata: {+ [CHAT_ERROR_METADATA_KEY]: {+ errorType: 'guardrail',+ guardrail: {+ verdict: 'blocked',+ score: 0.92,+ reasons: [{ code: 'pii_exfiltration', message: 'The reply contained a customer SSN.' }],+ },+ },+ },+ },+ },+};++describe('ChatErrorNotice', () => {+ it('renders the guardrail card with the verdict and reasons for a guardrail chat_error', () => {+ render(<Harness messages={[guardrailMessage]} />);++ const card = screen.getByTestId('assistant-ui-guardrail-notice');+ expect(card).toHaveTextContent('blocked');+ expect(card).toHaveTextContent(/customer SSN/);+ });++ it('renders nothing for an ordinary assistant message', () => {+ render(+ <Harness+ messages={[{ role: 'assistant', content: [{ type: 'text', text: 'Hello there' }] }]}+ />+ );++ expect(screen.queryByTestId('assistant-ui-guardrail-notice')).not.toBeInTheDocument();+ });++ it('renders nothing for a non-guardrail chat_error', () => {+ render(+ <Harness+ messages={[+ {+ role: 'assistant',+ content: [{ type: 'text', text: 'Something went wrong.' }],+ metadata: {+ custom: {+ extraMetadata: { [CHAT_ERROR_METADATA_KEY]: { errorType: 'timeout' } },+ },+ },+ },+ ]}+ />+ );++ expect(screen.queryByTestId('assistant-ui-guardrail-notice')).not.toBeInTheDocument();+ });+});diff --git a/app/src/features/conversations/aui/ChatMemoryChips.test.tsx b/app/src/features/conversations/aui/ChatMemoryChips.test.tsxindex c3493bcee2..57897c3f8a 100644--- a/app/src/features/conversations/aui/ChatMemoryChips.test.tsx+++ b/app/src/features/conversations/aui/ChatMemoryChips.test.tsx@@ -51,19 +51,19 @@ describe('memoryToolChips', () => {describe('memory tool call renders', () => {it('MemoryStoreCall renders the vendored memory-chips element', () => {- withI18n(<MemoryStoreCall {...toolCallProps('memory_store', { key: 'favorite_color' }, undefined)} />);+ render(<MemoryStoreCall {...toolCallProps('memory_store', { key: 'favorite_color' }, undefined)} />);expect(screen.getByText('favorite_color')).toBeTruthy();});it('MemoryRecallCall renders nothing for an empty result', () => {- const { container } = withI18n(+ const { container } = render(<MemoryRecallCall {...toolCallProps('memory_recall', undefined, [])} />);expect(container.querySelector('[data-slot="memory-chips"]')).toBeNull();});it('MemoryHybridSearchCall renders one chip per hit', () => {- withI18n(+ render(<MemoryHybridSearchCall{...toolCallProps('memory_hybrid_search', undefined, { results: [{ key: 'k1' }, { key: 'k2' }] })}/>diff --git a/crates/openhuman-core/src/web_chat/presentation_test_support_tests.rs b/crates/openhuman-core/src/web_chat/presentation_test_support_tests.rsindex c61a98860c..13d4b32725 100644--- a/crates/openhuman-core/src/web_chat/presentation_test_support_tests.rs+++ b/crates/openhuman-core/src/web_chat/presentation_test_support_tests.rs@@ -53,6 +53,9 @@ pub async fn deliver_response_in_workspace_for_test(None,workspace_dir,None,+ // Test helper: suggestions are exercised directly against+ // `web_chat::suggestions`, not through this shared delivery path.+ false,).await;}