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(memory): cover engine tab and cortex announcement
Steven Enamakel517241dc9cdb
diff --git a/app/src/components/memory/MemoryCortexAnnouncement.test.tsx b/app/src/components/memory/MemoryCortexAnnouncement.test.tsxnew file mode 100644index 0000000000..825bedd2ff--- /dev/null+++ b/app/src/components/memory/MemoryCortexAnnouncement.test.tsx@@ -0,0 +1,51 @@+import { fireEvent, screen, waitFor } from '@testing-library/react';+import { beforeEach, describe, expect, it, vi } from 'vitest';++import { renderWithProviders } from '../../test/test-utils';+import MemoryCortexAnnouncement, { CORTEX_ANNOUNCEMENT_KEY } from './MemoryCortexAnnouncement';++const store = vi.hoisted(() => ({ values: new Map<string, string>(), fail: false }));++vi.mock('../../store/userScopedStorage', () => ({+ userScopedStorage: {+ getItem: vi.fn(async (key: string) => {+ if (store.fail) throw new Error('storage unavailable');+ return store.values.get(key) ?? null;+ }),+ setItem: vi.fn(async (key: string, value: string) => {+ store.values.set(key, value);+ }),+ },+}));++describe('MemoryCortexAnnouncement', () => {+ beforeEach(() => {+ store.values.clear();+ store.fail = false;+ });++ it('announces the move to CortexDB until dismissed, and stays dismissed', async () => {+ const { unmount } = renderWithProviders(<MemoryCortexAnnouncement />);+ const banner = await screen.findByTestId('memory-cortex-announcement');+ expect(banner).toHaveTextContent('Memory now runs on CortexDB');+ expect(banner).toHaveTextContent('TinyCortex');+ expect(banner).toHaveTextContent('never used for training');++ fireEvent.click(screen.getByTestId('memory-cortex-announcement-dismiss'));+ expect(screen.queryByTestId('memory-cortex-announcement')).not.toBeInTheDocument();+ expect(store.values.get(CORTEX_ANNOUNCEMENT_KEY)).toBe('true');++ unmount();+ renderWithProviders(<MemoryCortexAnnouncement />);+ // Give storage a chance to answer; the banner must not come back.+ await waitFor(() => expect(store.values.get(CORTEX_ANNOUNCEMENT_KEY)).toBe('true'));+ await new Promise(resolve => setTimeout(resolve, 0));+ expect(screen.queryByTestId('memory-cortex-announcement')).not.toBeInTheDocument();+ });++ it('still shows when storage cannot be read', async () => {+ store.fail = true;+ renderWithProviders(<MemoryCortexAnnouncement />);+ expect(await screen.findByTestId('memory-cortex-announcement')).toBeInTheDocument();+ });+});diff --git a/app/src/components/memory/MemoryEngineTab.test.tsx b/app/src/components/memory/MemoryEngineTab.test.tsxindex c833def5c0..49e43bf42f 100644--- a/app/src/components/memory/MemoryEngineTab.test.tsx+++ b/app/src/components/memory/MemoryEngineTab.test.tsx@@ -226,13 +226,14 @@ describe('MemoryEngineTab', () => {expect(screen.getByTestId('memory-engine-builtin-note')).toHaveTextContent('Unlimited memory on your Pro plan');+ // Fair use sits behind an info icon.+ expect(screen.queryByTestId('memory-engine-fair-use')).not.toBeInTheDocument();+ fireEvent.click(screen.getByTestId('memory-engine-fair-use-trigger'));const terms = screen.getByTestId('memory-engine-fair-use');expect(terms).toHaveTextContent('Fair use applies');expect(terms).toHaveTextContent('No automated bulk uploads');fireEvent.click(within(terms).getByTestId('memory-engine-terms'));- expect(hoisted.openUrl).toHaveBeenCalledWith(- 'https://tinyhumans.gitbook.io/openhuman/legal/terms-of-use'- );+ expect(hoisted.openUrl).toHaveBeenCalledWith('https://tinyhumans.ai/terms');});it('points free plans at Basic and Pro', () => {@@ -261,7 +262,7 @@ describe('MemoryEngineTab', () => {});expect(hoisted.toastAdd).toHaveBeenCalledWith(expect.objectContaining({- description: 'CortexDB with your API key now stores your memory.',+ description: 'CortexDB with your own key now stores your memory.',}));});