Skip to content

Commit cc50a7c

Browse files
committed
fix tests
1 parent e65ef9c commit cc50a7c

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed

exercises/02.tools/01.problem.simple/src/index.test.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,18 @@ import {
66
import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js'
77
import { test, expect } from 'vitest'
88

9-
async function setupClient() {
10-
const client = new Client({
11-
name: 'EpicMeTester',
12-
version: '1.0.0',
13-
})
9+
async function setupClient({ capabilities }: ClientOptions = {}) {
10+
const client = new Client(
11+
{
12+
name: 'EpicMeTester',
13+
version: '1.0.0',
14+
},
15+
{ capabilities },
16+
)
1417
const transport = new StdioClientTransport({
1518
command: 'tsx',
1619
args: ['src/index.ts'],
20+
stderr: 'ignore',
1721
})
1822
await client.connect(transport)
1923
return {

exercises/03.resources/05.problem.linked/src/index.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,19 @@ async function setupClient({ capabilities }: ClientOptions = {}) {
2626
const transport = new StdioClientTransport({
2727
command: 'tsx',
2828
args: ['src/index.ts'],
29+
stderr: 'ignore',
2930
env: {
3031
...process.env,
3132
EPIC_ME_DB_PATH,
3233
},
33-
stderr: 'ignore',
3434
})
3535
await client.connect(transport)
3636
return {
3737
client,
3838
EPIC_ME_DB_PATH,
3939
async [Symbol.asyncDispose]() {
4040
await client.transport?.close()
41-
await fs.unlink(EPIC_ME_DB_PATH)
41+
await fs.unlink(EPIC_ME_DB_PATH).catch(() => {})
4242
},
4343
}
4444
}

exercises/04.prompts/03.problem.completion/src/index.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ test('Prompts List', async () => {
162162
})
163163

164164
test('Prompt Argument Completion', async () => {
165-
await using setup = await setupClient()
165+
await using setup = await setupClient({ capabilities: { completion: true } })
166166
const { client } = setup
167167
// First create some entries to have data for completion
168168
await client.callTool({
@@ -200,9 +200,9 @@ test('Prompt Argument Completion', async () => {
200200
invariant(firstArg, '🚨 First prompt argument should exist')
201201

202202
// Test completion functionality using the proper MCP SDK method
203-
const completionResult = await (client as any).completePrompt({
203+
const completionResult = await client.complete({
204204
ref: {
205-
type: 'prompt',
205+
type: 'ref/prompt',
206206
name: firstPrompt.name,
207207
},
208208
argument: {

0 commit comments

Comments
 (0)