AI Newsletter Digest improvements: fixed QP soft line break decoding, URL extraction, and content cleaning

This commit is contained in:
Krilly
2026-03-04 13:29:22 +00:00
parent 29a98137a7
commit 57dd294675
13706 changed files with 2114953 additions and 237629 deletions

View File

@@ -0,0 +1,41 @@
import { describe, it, expect } from 'vitest';
import { app } from './index.js';
describe('Server API', () => {
it('GET /api/info returns bot info', async () => {
// Note: This relies on actual file system unless mocked.
// Ideally we mock fs, but for integration test on CI it's fine.
const res = await app.request('/api/info');
expect(res.status).toBe(200);
const data = await res.json();
expect(data).toHaveProperty('version');
});
it('GET /api/agent/status returns structure', async () => {
const res = await app.request('/api/agent/status');
expect(res.status).toBe(200);
const data = await res.json();
expect(data).toHaveProperty('config');
expect(data).toHaveProperty('gateway');
});
});
describe('Backlinks API', () => {
// These tests rely on the actual WORKSPACE directory (~/clawd by default)
// They test the API structure and basic behavior
it('GET /api/resolve-wikilink returns 400 without link', async () => {
const res = await app.request('/api/resolve-wikilink');
expect(res.status).toBe(400);
});
it('GET /api/resolve-wikilink resolves existing file', async () => {
// MEMORY.md should exist in the workspace
const res = await app.request('/api/resolve-wikilink?link=MEMORY');
expect(res.status).toBe(200);
const data = await res.json();
expect(data).toHaveProperty('found');
expect(data).toHaveProperty('path');
});
it('GET /api/resolve-wikilink returns not found for nonexistent', async () => {
const res = await app.request('/api/resolve-wikilink?link=nonexistent-file-that-does-not-exist-12345');
expect(res.status).toBe(200);
const data = await res.json();
expect(data.found).toBe(false);
});
});

File diff suppressed because it is too large Load Diff