Skip to content

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

fix(ui): correct memory engine setup test expectations

Steven Enamakelb60ee1e37a24
diff --git a/app/src/components/memory/MemoryEngineSetup.test.tsx b/app/src/components/memory/MemoryEngineSetup.test.tsx
new file mode 100644
index 0000000000..091700dd67
--- /dev/null
+++ b/app/src/components/memory/MemoryEngineSetup.test.tsx
@@ -0,0 +1,48 @@
+import { screen } from '@testing-library/react';
+import { beforeEach, describe, expect, it, vi } from 'vitest';
+
+import { renderWithProviders } from '../../test/test-utils';
+import MemoryEngineSetup from './MemoryEngineSetup';
+
+const hoisted = vi.hoisted(() => ({ engineGet: vi.fn(), tabProps: vi.fn() }));
+
+vi.mock('../../services/api/memoryApi', async importOriginal => ({
+ ...(await importOriginal<typeof import('../../services/api/memoryApi')>()),
+ memoryEngineGet: (...a: unknown[]) => hoisted.engineGet(...a),
+}));
+
+vi.mock('./MemoryEngineTab', () => ({
+ default: (props: { state: { engine: string | null; status: string } | null }) => {
+ hoisted.tabProps(props);
+ return (
+ <div data-testid="engine-tab">
+ {props.state ? `${props.state.engine ?? 'none'}:${props.state.status}` : 'loading'}
+ </div>
+ );
+ },
+}));
+
+beforeEach(() => {
+ hoisted.engineGet.mockReset();
+ hoisted.tabProps.mockReset();
+});
+
+describe('MemoryEngineSetup', () => {
+ it('feeds the engine picker the current engine state', async () => {
+ hoisted.engineGet.mockResolvedValue({
+ engine: 'tinyhumans',
+ has_key: false,
+ status: 'ok',
+ fetch_modes: [],
+ });
+ renderWithProviders(<MemoryEngineSetup />);
+ expect(await screen.findByText('tinyhumans:ok')).toBeInTheDocument();
+ expect(hoisted.tabProps).toHaveBeenLastCalledWith(expect.objectContaining({ embedded: true }));
+ });
+
+ it('falls back to off when the engine cannot be read', async () => {
+ hoisted.engineGet.mockRejectedValue(new Error('offline'));
+ renderWithProviders(<MemoryEngineSetup />);
+ expect(await screen.findByText('none:off')).toBeInTheDocument();
+ });
+});
diff --git a/vendor/tinymemory b/vendor/tinymemory
index f86615d86c..3287716f4b 160000
--- a/vendor/tinymemory
+++ b/vendor/tinymemory
@@ -1 +1 @@
-Subproject commit f86615d86ca63644cbaa76d8569f2ff6250f2d1f
+Subproject commit 3287716f4b0cd65088519b6a1ad4dab3db0ff9f6