chore(mcp): drop extra unit tests for search and profile

e2e already covers search_memory and get_profile.
This commit is contained in:
Dhravya 2026-09-13 23:43:30 +00:00
parent 7616c85b9b
commit b9bfa7f4ce
2 changed files with 0 additions and 181 deletions

View file

@ -1,88 +0,0 @@
import { describe, expect, it } from "vitest"
import * as getProfile from "./get-profile"
import type { ToolDeps } from "./types"
function registerProfile(client: {
getProfile: () => Promise<{
profile: { static: string[]; dynamic: string[] }
}>
}) {
let handler:
| ((args: { containerTag?: string }) => Promise<unknown>)
| undefined
getProfile.register({
server: {
registerTool: (
_name: string,
_config: unknown,
registered: (args: { containerTag?: string }) => Promise<unknown>,
) => {
handler = registered
},
},
resolveContainerTag: async (tag?: string) => tag ?? "sm_project_default",
getClient: () => client,
errorResult: (error: unknown) => ({
content: [
{
type: "text" as const,
text: error instanceof Error ? error.message : "error",
},
],
isError: true,
}),
} as unknown as ToolDeps)
if (!handler) throw new Error("getProfile was not registered")
return handler
}
describe("get_profile", () => {
it("returns stable and recent profile facts for the resolved space", async () => {
const handler = registerProfile({
getProfile: async () => ({
profile: {
static: ["User is a software engineer"],
dynamic: ["User is debugging auth"],
},
}),
})
const result = (await handler({ containerTag: "team_eng" })) as {
content: Array<{ text: string }>
structuredContent: {
containerTag: string
profile: { static: string[]; dynamic: string[] }
}
}
expect(result.structuredContent).toEqual({
containerTag: "team_eng",
profile: {
static: ["User is a software engineer"],
dynamic: ["User is debugging auth"],
},
})
expect(result.content[0]?.text).toContain("## Stable Context")
expect(result.content[0]?.text).toContain("User is a software engineer")
expect(result.content[0]?.text).toContain("## Recent Context")
expect(result.content[0]?.text).toContain("User is debugging auth")
})
it("says when the space has no profile facts yet", async () => {
const handler = registerProfile({
getProfile: async () => ({
profile: { static: [], dynamic: [] },
}),
})
const result = (await handler({})) as {
content: Array<{ text: string }>
}
expect(result.content[0]?.text).toBe(
"No profile facts are available for this space yet.",
)
})
})

View file

@ -1,93 +0,0 @@
import { describe, expect, it, vi } from "vitest"
import * as searchMemory from "./search-memory"
import type { ToolDeps } from "./types"
function registerSearch(client: {
search: (query: string) => Promise<{
results: Array<{
id: string
memory?: string
chunk?: string
similarity: number
title?: string
}>
total: number
timing: number
}>
getProfile?: () => Promise<unknown>
}) {
let handler:
| ((args: { query: string; containerTag?: string }) => Promise<unknown>)
| undefined
searchMemory.register({
server: {
registerTool: (
_name: string,
_config: unknown,
registered: (args: {
query: string
containerTag?: string
}) => Promise<unknown>,
) => {
handler = registered
},
},
resolveContainerTag: async (tag?: string) => tag ?? "sm_project_default",
getClient: () => client,
errorResult: (error: unknown) => ({
content: [
{
type: "text" as const,
text: error instanceof Error ? error.message : "error",
},
],
isError: true,
}),
} as unknown as ToolDeps)
if (!handler) throw new Error("searchMemory was not registered")
return handler
}
describe("search_memory", () => {
it("returns matching memories without fetching or including profile", async () => {
const getProfile = vi.fn()
const handler = registerSearch({
getProfile,
search: async () => ({
results: [
{
id: "mem_1",
memory: "User prefers dark mode",
similarity: 0.91,
},
],
total: 1,
timing: 12,
}),
})
const result = (await handler({ query: "theme preference" })) as {
content: Array<{ text: string }>
structuredContent: {
profile?: unknown
results: Array<{ text: string }>
}
}
expect(getProfile).not.toHaveBeenCalled()
expect(result.content[0]?.text).toContain("## Matching memories")
expect(result.content[0]?.text).toContain("User prefers dark mode")
expect(result.content[0]?.text).not.toContain("## Profile")
expect(result.content[0]?.text).not.toContain("## Recent context")
expect(result.structuredContent.profile).toBeUndefined()
expect(result.structuredContent.results).toEqual([
{
id: "mem_1",
text: "User prefers dark mode",
similarity: 0.91,
},
])
})
})