kimi-code/packages/node-sdk/test/session-prompt-input.test.ts
2026-05-22 15:54:50 +08:00

27 lines
872 B
TypeScript

import { describe, expect, it, vi } from 'vitest';
import type { SDKRpcClient } from '../src/rpc';
import { Session } from '../src/session';
describe('Session.prompt input normalization', () => {
it('passes multimodal prompt parts through to the core RPC client', async () => {
const prompt = vi.fn(async () => {});
const session = new Session({
id: 'ses_multimodal_prompt',
workDir: '/tmp/work',
rpc: { prompt } as unknown as SDKRpcClient,
});
const input = [
{ type: 'text', text: 'describe these' },
{ type: 'image_url', imageUrl: { url: 'data:image/png;base64,AAAA' } },
{ type: 'video_url', videoUrl: { url: 'ms://file-123', id: 'file-123' } },
] as const;
await session.prompt(input);
expect(prompt).toHaveBeenCalledWith({
sessionId: 'ses_multimodal_prompt',
input,
});
});
});