openpencil/apps
Fini ab35c0d777 test(ai): Nitro /api/mcp/exec-tool endpoint unit tests (12 cases)
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.
2026-04-22 00:41:15 +08:00
..
cli chore(release): bump to v0.7.4 2026-04-17 19:20:19 +08:00
desktop test(electron): unblock desktop/git tests on git 2.36 + stubbed electron 2026-04-20 01:22:28 +08:00
web test(ai): Nitro /api/mcp/exec-tool endpoint unit tests (12 cases) 2026-04-22 00:41:15 +08:00