Skip to content

Commit 26329c9

Browse files
author
Silicon 01
committed
feat: cron manager — user/system tabs, run history time fix, hono backend
- Add CronManager component with user cron jobs and system scheduling tabs - System crons: heartbeat, compaction, context pruning, session cleanup, QMD - Fix run history Invalid Date (use runAtMs/ts instead of startedAt) - Add system-crons API endpoint reading from openclaw config - Batch rename all cron jobs to Chinese names with emoji
1 parent 97c3e80 commit 26329c9

7 files changed

Lines changed: 1935 additions & 3 deletions

File tree

server-dist/api.test.js

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import { describe, it, expect } from 'vitest';
2+
import { app } from './index.js';
3+
describe('Server API', () => {
4+
it('GET /api/info returns bot info', async () => {
5+
// Note: This relies on actual file system unless mocked.
6+
// Ideally we mock fs, but for integration test on CI it's fine.
7+
const res = await app.request('/api/info');
8+
expect(res.status).toBe(200);
9+
const data = await res.json();
10+
expect(data).toHaveProperty('version');
11+
});
12+
it('GET /api/agent/status returns structure', async () => {
13+
const res = await app.request('/api/agent/status');
14+
expect(res.status).toBe(200);
15+
const data = await res.json();
16+
expect(data).toHaveProperty('config');
17+
expect(data).toHaveProperty('gateway');
18+
});
19+
});
20+
describe('Backlinks API', () => {
21+
// These tests rely on the actual WORKSPACE directory (~/clawd by default)
22+
// They test the API structure and basic behavior
23+
it('GET /api/resolve-wikilink returns 400 without link', async () => {
24+
const res = await app.request('/api/resolve-wikilink');
25+
expect(res.status).toBe(400);
26+
});
27+
it('GET /api/resolve-wikilink resolves existing file', async () => {
28+
// MEMORY.md should exist in the workspace
29+
const res = await app.request('/api/resolve-wikilink?link=MEMORY');
30+
expect(res.status).toBe(200);
31+
const data = await res.json();
32+
expect(data).toHaveProperty('found');
33+
expect(data).toHaveProperty('path');
34+
});
35+
it('GET /api/resolve-wikilink returns not found for nonexistent', async () => {
36+
const res = await app.request('/api/resolve-wikilink?link=nonexistent-file-that-does-not-exist-12345');
37+
expect(res.status).toBe(200);
38+
const data = await res.json();
39+
expect(data.found).toBe(false);
40+
});
41+
});

0 commit comments

Comments
 (0)