Skip to content

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

fix(chat): restore missing ChatMemoryChips test file

Steven Enamakel57a0261b0bd1
diff --git a/app/src/features/conversations/aui/ChatMemoryChips.test.tsx b/app/src/features/conversations/aui/ChatMemoryChips.test.tsx
new file mode 100644
index 0000000000..131588a3aa
--- /dev/null
+++ b/app/src/features/conversations/aui/ChatMemoryChips.test.tsx
@@ -0,0 +1,47 @@
+import { render, screen } from '@testing-library/react';
+import { describe, expect, it } from 'vitest';
+
+import { I18nProvider } from '../../../lib/i18n/I18nContext';
+import { MemoryHybridSearchCall, MemoryRecallCall, MemoryStoreCall, memoryToolChips } from './ChatMemoryChips';
+
+function withI18n(node: React.ReactElement) {
+ return render(<I18nProvider>{node}</I18nProvider>);
+}
+
+describe('memoryToolChips', () => {
+ it('builds one "added" chip for a memory_store call, keyed by its key', () => {
+ const chips = memoryToolChips('memory_store', { key: 'favorite_color', content: 'blue' }, undefined);
+ expect(chips).toEqual([{ id: 'store:favorite_color', text: 'favorite_color', change: 'added' }]);
+ });
+
+ it('builds one "existing" chip per hit for memory_recall / memory_hybrid_search', () => {
+ const chips = memoryToolChips('memory_recall', undefined, [
+ { key: 'favorite_color', text: 'blue' },
+ { key: 'timezone', text: 'UTC+2' },
+ ]);
+ expect(chips.map(c => c.text)).toEqual(['favorite_color', 'timezone']);
+ expect(chips.every(c => c.change === 'existing')).toBe(true);
+ });
+
+ it('returns nothing for a tool name it does not know', () => {
+ expect(memoryToolChips('memory_forget', {}, undefined)).toEqual([]);
+ });
+});
+
+describe('memory tool call renders', () => {
+ it('MemoryStoreCall renders the vendored memory-chips element', () => {
+ withI18n(<MemoryStoreCall args={{ key: 'favorite_color' }} result={undefined} />);
+ expect(screen.getByText('favorite_color')).toBeTruthy();
+ });
+
+ it('MemoryRecallCall renders nothing for an empty result', () => {
+ const { container } = withI18n(<MemoryRecallCall args={undefined} result={[]} />);
+ expect(container.querySelector('[data-slot="memory-chips"]')).toBeNull();
+ });
+
+ it('MemoryHybridSearchCall renders one chip per hit', () => {
+ withI18n(<MemoryHybridSearchCall args={undefined} result={{ results: [{ key: 'k1' }, { key: 'k2' }] }} />);
+ expect(screen.getByText('k1')).toBeTruthy();
+ expect(screen.getByText('k2')).toBeTruthy();
+ });
+});