openpencil/apps/web/server
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
..
__tests__ test(ai): Nitro /api/mcp/exec-tool endpoint unit tests (12 cases) 2026-04-22 00:41:15 +08:00
api feat(ai): complete embedded element-tool coverage to 42/42 2026-04-22 00:19:30 +08:00
opencode V0.7.3 (#111) 2026-04-15 22:19:12 +08:00
plugins V0.7.0 (#95) 2026-04-11 23:25:13 +08:00
utils V0.7.2-bugfix (#109) 2026-04-14 21:42:56 +08:00