Add memory-viewer from silicondawn
- Web UI for browsing and editing OpenClaw memory files - Cloned from https://github.com/silicondawn/memory-viewer - Built and running on port 8901 - Features: file tree, markdown rendering, search, live reload - Full access to MEMORY.md, daily notes, skills, automations
This commit is contained in:
42
memory-viewer/src/components/AgentStatus.test.tsx
Normal file
42
memory-viewer/src/components/AgentStatus.test.tsx
Normal file
@@ -0,0 +1,42 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import { AgentStatusPage } from '../components/AgentStatus';
|
||||
import { LocaleContext } from '../hooks/useLocale';
|
||||
|
||||
// Mock dependencies
|
||||
vi.mock('../api', () => ({
|
||||
fetchAgentStatus: vi.fn().mockResolvedValue({
|
||||
config: { version: '1.2.0', update: { channel: 'stable' } },
|
||||
gateway: { runtime: { status: 'running', pid: 1234 } },
|
||||
heartbeat: { lastRun: Date.now() }
|
||||
})
|
||||
}));
|
||||
|
||||
// Mock shiki
|
||||
vi.mock('shiki', () => ({
|
||||
createHighlighter: vi.fn().mockResolvedValue({
|
||||
codeToHtml: () => '<pre>mock code</pre>'
|
||||
})
|
||||
}));
|
||||
|
||||
describe('AgentStatusPage', () => {
|
||||
it('renders loading state initially', () => {
|
||||
// We can't easily test loading state with async useEffect,
|
||||
// but we can test the happy path after wait
|
||||
});
|
||||
|
||||
it('renders status after load', async () => {
|
||||
const mockLocale = { t: (k: string) => k, toggleLocale: () => {}, locale: 'en' as const };
|
||||
|
||||
render(
|
||||
<LocaleContext.Provider value={mockLocale}>
|
||||
<AgentStatusPage />
|
||||
</LocaleContext.Provider>
|
||||
);
|
||||
|
||||
// Should eventually show the version
|
||||
expect(await screen.findByText('v1.2.0')).toBeInTheDocument();
|
||||
// Should show gateway running status key
|
||||
expect(screen.getByText('agent.running')).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user