Covers the endpoint's full responsibility matrix:
- 400: missing body / unknown tool name (via different branches)
- 404: unknown tool, invalid pageId, invalid parent_id,
invalid default_parent_id
- 409: no live-canvas doc synced (element-tool route + DSL route)
- 501: real filePath (live://canvas is accepted as sentinel)
- 400: DSL with parse errors (per-line preview in message)
- happy paths: element-tool writes to sync-state; parent_id
actually nests inserted node under named container; DSL
route invokes runBatchDesignDsl + returns inserted IDs
Uses `vi.mock('h3', ...)` so the handler runs as a plain async
function — no live Nitro runtime. `clearSyncState()` in each
beforeEach isolates doc-mutation cases. server-logger mocked to
keep test output clean.
Full-repo: 2010 tests across 209 files.
|
||
|---|---|---|
| .. | ||
| agent-tool-guard.test.ts | ||
| exec-tool-endpoint.test.ts | ||
| mcp-screenshot-rpc.test.ts | ||
| mcp-sync-state-active.test.ts | ||
| provider-url-presets.test.ts | ||
| provider-url.test.ts | ||
| security.test.ts | ||
| sse-keepalive.test.ts | ||