test(mcp): stabilize lsp builtin and doctor checks
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -1,9 +1,16 @@
|
||||
import { describe, expect, test } from "bun:test"
|
||||
import { createBuiltinMcps } from "../index"
|
||||
import { afterEach, describe, expect, mock, test } from "bun:test"
|
||||
|
||||
afterEach(() => {
|
||||
mock.restore()
|
||||
})
|
||||
|
||||
describe("createBuiltinMcps", () => {
|
||||
test("should return all MCPs when disabled_mcps is empty", () => {
|
||||
// given
|
||||
mock.module("../lsp", () => ({
|
||||
createLspMcpConfig: () => ({ type: "local", command: ["node", "dist/cli.js", "mcp"], enabled: true }),
|
||||
}))
|
||||
const { createBuiltinMcps } = require("../index") as typeof import("../index")
|
||||
const disabledMcps: string[] = []
|
||||
|
||||
// when
|
||||
@@ -19,6 +26,10 @@ describe("createBuiltinMcps", () => {
|
||||
|
||||
test("should filter out disabled MCPs", () => {
|
||||
// given
|
||||
mock.module("../lsp", () => ({
|
||||
createLspMcpConfig: () => ({ type: "local", command: ["node", "dist/cli.js", "mcp"], enabled: true }),
|
||||
}))
|
||||
const { createBuiltinMcps } = require("../index") as typeof import("../index")
|
||||
const disabledMcps = ["websearch"]
|
||||
|
||||
// when
|
||||
@@ -33,6 +44,10 @@ describe("createBuiltinMcps", () => {
|
||||
|
||||
test("should return empty array when all MCPs are disabled", () => {
|
||||
// given - disable all known MCPs
|
||||
mock.module("../lsp", () => ({
|
||||
createLspMcpConfig: () => ({ type: "local", command: ["node", "dist/cli.js", "mcp"], enabled: true }),
|
||||
}))
|
||||
const { createBuiltinMcps } = require("../index") as typeof import("../index")
|
||||
const disabledMcps = ["websearch", "context7", "grep_app", "lsp"]
|
||||
|
||||
// when
|
||||
|
||||
Reference in New Issue
Block a user