mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-05-13 15:32:19 +00:00
fix(cli): update ModelDialog tests for composite-key model identity
Add missing getModelsConfig and getActiveRuntimeModelSnapshot mocks,
and update switchModel assertion to expect the new { baseUrl } options
object introduced in 4c4ebb81c.
This commit is contained in:
parent
4c4ebb81ca
commit
2b3a8c07e6
1 changed files with 15 additions and 5 deletions
|
|
@ -70,6 +70,10 @@ const renderComponent = (
|
|||
authType: AuthType.QWEN_OAUTH,
|
||||
})),
|
||||
),
|
||||
getModelsConfig: vi.fn(() => ({
|
||||
getGenerationConfig: vi.fn(() => ({ baseUrl: undefined })),
|
||||
})),
|
||||
getActiveRuntimeModelSnapshot: vi.fn(() => undefined),
|
||||
|
||||
// --- Functions used by ClearcutLogger ---
|
||||
getUsageStatisticsEnabled: vi.fn(() => true),
|
||||
|
|
@ -268,11 +272,9 @@ describe('<ModelDialog />', () => {
|
|||
// Select a non-OAuth model (USE_OPENAI)
|
||||
await childOnSelect(`${AuthType.USE_OPENAI}::gpt-4`);
|
||||
|
||||
expect(switchModel).toHaveBeenCalledWith(
|
||||
AuthType.USE_OPENAI,
|
||||
'gpt-4',
|
||||
undefined,
|
||||
);
|
||||
expect(switchModel).toHaveBeenCalledWith(AuthType.USE_OPENAI, 'gpt-4', {
|
||||
baseUrl: undefined,
|
||||
});
|
||||
expect(mockSettings.setValue).toHaveBeenCalledWith(
|
||||
SettingScope.User,
|
||||
'model.name',
|
||||
|
|
@ -370,6 +372,10 @@ describe('<ModelDialog />', () => {
|
|||
it('updates initialIndex when config context changes', () => {
|
||||
const mockGetModel = vi.fn(() => DEFAULT_QWEN_MODEL);
|
||||
const mockGetAuthType = vi.fn(() => 'qwen-oauth');
|
||||
const mockGetModelsConfig = vi.fn(() => ({
|
||||
getGenerationConfig: vi.fn(() => ({ baseUrl: undefined })),
|
||||
}));
|
||||
const mockGetActiveRuntimeModelSnapshot = vi.fn(() => undefined);
|
||||
const mockSettings = {
|
||||
isTrusted: true,
|
||||
user: { settings: {} },
|
||||
|
|
@ -393,6 +399,8 @@ describe('<ModelDialog />', () => {
|
|||
authType: AuthType.QWEN_OAUTH,
|
||||
})),
|
||||
),
|
||||
getModelsConfig: mockGetModelsConfig,
|
||||
getActiveRuntimeModelSnapshot: mockGetActiveRuntimeModelSnapshot,
|
||||
} as unknown as Config
|
||||
}
|
||||
>
|
||||
|
|
@ -417,6 +425,8 @@ describe('<ModelDialog />', () => {
|
|||
authType: AuthType.QWEN_OAUTH,
|
||||
})),
|
||||
),
|
||||
getModelsConfig: mockGetModelsConfig,
|
||||
getActiveRuntimeModelSnapshot: mockGetActiveRuntimeModelSnapshot,
|
||||
} as unknown as Config;
|
||||
|
||||
rerender(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue