Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,30 @@ import { afterEach, describe, expect, it, mock, spyOn } from 'bun:test';
import type { McpServerConfig } from '@neokai/shared';
import type { AgentSessionInit } from '../../../src/lib/agent/agent-session';

// Re-declare the SDK mock here so it survives Bun's module isolation between
// test files. Without this, dynamic `await import(...)` calls in this file
// (e.g. `import('../../../src/lib/room/runtime/room-runtime-service')`) can
// resolve the real SDK module before the preload-level mock from setup.ts is
// re-applied, causing a SyntaxError on CI where the installed SDK version
// (0.2.81) does not always export `createSdkMcpServer` at the ESM level.
mock.module('@anthropic-ai/claude-agent-sdk', () => ({
query: mock(async () => ({ interrupt: () => {} })),
interrupt: mock(async () => {}),
supportedModels: mock(async () => {
throw new Error('SDK unavailable');
}),
createSdkMcpServer: mock((_opts: { name: string }) => ({
type: 'sdk' as const,
name: _opts.name,
version: '1.0.0',
tools: [],
instance: { connect() {}, disconnect() {} },
})),
tool: mock((_name: string, _desc: string, _schema: unknown, _handler: unknown) => ({
name: _name,
})),
}));

// ---------------------------------------------------------------------------
// Helpers
// ---------------------------------------------------------------------------
Expand Down
Loading