fix(test): add missing ToolContext fields to test mocks

@opencode-ai/plugin ToolContext now requires directory, worktree,
metadata, and ask fields. Updated all tool test mocks to comply.
This commit is contained in:
justsisyphus
2026-02-01 14:16:28 +09:00
parent c859a23158
commit 97dffb23a7
4 changed files with 34 additions and 5 deletions
+6 -1
View File
@@ -1,4 +1,5 @@
import { describe, it, expect, beforeEach, mock } from "bun:test"
import type { ToolContext } from "@opencode-ai/plugin/tool"
import { createSkillMcpTool, applyGrepFilter } from "./tools"
import { SkillMcpManager } from "../../features/skill-mcp-manager"
import type { LoadedSkill } from "../../features/opencode-skill-loader/types"
@@ -18,11 +19,15 @@ function createMockSkillWithMcp(name: string, mcpServers: Record<string, unknown
}
}
const mockContext = {
const mockContext: ToolContext = {
sessionID: "test-session",
messageID: "msg-1",
agent: "test-agent",
directory: "/test",
worktree: "/test",
abort: new AbortController().signal,
metadata: () => {},
ask: async () => {},
}
describe("skill_mcp tool", () => {