Skip to content

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

test(memory): cover import banner and migration tab

Steven Enamakel415c2b68b692
diff --git a/app/src/components/memory/MemoryImportBanner.test.tsx b/app/src/components/memory/MemoryImportBanner.test.tsx
index 2a50145107..351a57d340 100644
--- a/app/src/components/memory/MemoryImportBanner.test.tsx
+++ b/app/src/components/memory/MemoryImportBanner.test.tsx
@@ -64,6 +64,23 @@ describe('MemoryImportBanner', () => {
expect(screen.queryByTestId('memory-import-banner')).not.toBeInTheDocument();
});
+ it('shows the empty state once both scans find nothing to import or move', async () => {
+ hoisted.scan.mockResolvedValue({ found: false });
+ renderWithProviders(
+ <MemoryImportBanner engineLabel="TinyHumans" emptyState={<div data-testid="nothing" />} />
+ );
+ expect(await screen.findByTestId('nothing')).toBeInTheDocument();
+ expect(screen.queryByTestId('memory-import-banner')).not.toBeInTheDocument();
+ });
+
+ it('shows no empty state while there is something to import', async () => {
+ renderWithProviders(
+ <MemoryImportBanner engineLabel="TinyHumans" emptyState={<div data-testid="nothing" />} />
+ );
+ expect(await screen.findByTestId('memory-import-counts')).toBeInTheDocument();
+ expect(screen.queryByTestId('nothing')).not.toBeInTheDocument();
+ });
+
it('offers the import with the counts it found', async () => {
renderWithProviders(<MemoryImportBanner engineLabel="TinyHumans" />);
expect(await screen.findByTestId('memory-import-counts')).toHaveTextContent(
diff --git a/app/src/components/memory/MemoryMigrationTab.test.tsx b/app/src/components/memory/MemoryMigrationTab.test.tsx
new file mode 100644
index 0000000000..2451b91aa2
--- /dev/null
+++ b/app/src/components/memory/MemoryMigrationTab.test.tsx
@@ -0,0 +1,35 @@
+import { screen } from '@testing-library/react';
+import { describe, expect, it, vi } from 'vitest';
+
+import { renderWithProviders } from '../../test/test-utils';
+import MemoryMigrationTab from './MemoryMigrationTab';
+
+vi.mock('./MemoryCortexAnnouncement', () => ({
+ default: () => <div data-testid="stub-announcement" />,
+}));
+vi.mock('./MemoryImportBanner', () => ({
+ default: ({ engineLabel, emptyState }: { engineLabel: string; emptyState: React.ReactNode }) => (
+ <div data-testid="stub-import">
+ {engineLabel}
+ {emptyState}
+ </div>
+ ),
+}));
+
+describe('MemoryMigrationTab', () => {
+ it('shows the announcement and the import flow with its empty state', () => {
+ renderWithProviders(<MemoryMigrationTab engineLabel="TinyHumans" />);
+ expect(screen.getByTestId('stub-announcement')).toBeInTheDocument();
+ expect(screen.getByTestId('stub-import')).toHaveTextContent('TinyHumans');
+ expect(screen.getByTestId('memory-migration-empty')).toHaveTextContent('Nothing to migrate');
+ });
+
+ it('shows the off state in place of the import flow', () => {
+ renderWithProviders(
+ <MemoryMigrationTab engineLabel="TinyHumans" offState={<div data-testid="off" />} />
+ );
+ expect(screen.getByTestId('stub-announcement')).toBeInTheDocument();
+ expect(screen.getByTestId('off')).toBeInTheDocument();
+ expect(screen.queryByTestId('stub-import')).not.toBeInTheDocument();
+ });
+});