Severity: Medium
Location: test/loop.test.ts (only test file)
Description:
CashClaw has only one test file (test/loop.test.ts) covering the runAgentLoop function. Critical code paths have zero test coverage:
src/agent.ts — the entire HTTP server / API layer (no tests)
src/config.ts — config load/save/init (no tests)
src/heartbeat.ts — heartbeat logic including WebSocket, study sessions (no tests)
src/memory/*.ts — all memory modules (no tests)
src/tools/registry.ts — tool lookup (no tests)
src/moltlaunch/cli.ts — CLI wrapper (no tests)
src/llm/index.ts — LLM providers (no tests)
- Error paths and edge cases (e.g., malformed JSON in config files, WS disconnects, task deduplication logic)
The project has vitest set up and a test script, but only the happy-path loop flow is tested.
Suggested Fix:
Add test files for:
- Config validation (invalid JSON, missing fields, partial configs)
- API endpoints (use
supertest or raw http requests to test the server)
- Memory modules (atomic writes, cache invalidation, max entry trimming)
- Tool registry (tool lookup, unknown tool handling)
- Error paths (network failures, malformed responses from LLM, CLI ENOENT handling)
Severity: Medium
Location:
test/loop.test.ts(only test file)Description:
CashClaw has only one test file (
test/loop.test.ts) covering therunAgentLoopfunction. Critical code paths have zero test coverage:src/agent.ts— the entire HTTP server / API layer (no tests)src/config.ts— config load/save/init (no tests)src/heartbeat.ts— heartbeat logic including WebSocket, study sessions (no tests)src/memory/*.ts— all memory modules (no tests)src/tools/registry.ts— tool lookup (no tests)src/moltlaunch/cli.ts— CLI wrapper (no tests)src/llm/index.ts— LLM providers (no tests)The project has
vitestset up and atestscript, but only the happy-path loop flow is tested.Suggested Fix:
Add test files for:
supertestor rawhttprequests to test the server)