Files
Genarrative/apps/ai-game-creator-shell/tests/clientApi.test.ts
T
k88936 8009a70bb1 测试(AGC模型): 目录透传用例去掉过期的映射断言
- loadClientLlmModels 已改为直接透传 Rust typed command 结果
- 用例改名为透传断言,不再期望渲染层补默认 agentMode(该逻辑已下沉到 Rust)
2026-10-05 17:42:46 +08:00

32 lines
1.0 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// @vitest-environment jsdom
import { beforeEach, expect, test, vi } from 'vitest';
import { resolveTauriInvoke } from '../src/app/tauri';
import { loadClientLlmModels } from '../src/services/clientApi';
vi.mock('../src/app/tauri', () => ({ resolveTauriInvoke: vi.fn() }));
const invoke = vi.fn();
beforeEach(() => {
vi.clearAllMocks();
vi.mocked(resolveTauriInvoke).mockReturnValue(invoke);
});
test('模型目录直接透传 Rust typed command 的解析结果', async () => {
// agentMode / protocol 缺省已下沉到 Rust 的 load_game_creator_llm_models,
// 渲染层不再做二次归一化,这里断言原样透传即可。
const catalog = {
defaultModelId: 'quality',
models: [
{ id: 'quality', displayName: '高质量' },
{ id: 'claude', displayName: 'Claude', agentMode: 'cc' },
],
revision: 1,
};
invoke.mockResolvedValue(catalog);
await expect(loadClientLlmModels()).resolves.toEqual(catalog);
expect(invoke).toHaveBeenCalledWith('load_game_creator_llm_models');
});