|
1 | 1 | import { describe, expect, it, vi } from 'vitest'; |
2 | 2 | import { JSDOM } from 'jsdom'; |
3 | | -import { CommandExecutionError, TimeoutError } from '@jackwener/opencli/errors'; |
| 3 | +import { ArgumentError, CommandExecutionError, TimeoutError } from '@jackwener/opencli/errors'; |
4 | 4 | import { activityCommand } from './activity.js'; |
5 | 5 | import { approveCommand } from './approve.js'; |
6 | 6 | import { askCommand } from './ask.js'; |
@@ -335,6 +335,24 @@ describe('trae-cn commands', () => { |
335 | 335 | .rejects.toBeInstanceOf(CommandExecutionError); |
336 | 336 | }); |
337 | 337 |
|
| 338 | + it('select-model rejects ambiguous partial model names before changing selection', async () => { |
| 339 | + const page = { |
| 340 | + evaluate: vi.fn() |
| 341 | + .mockResolvedValueOnce([]) |
| 342 | + .mockResolvedValueOnce([ |
| 343 | + { Index: 0, Model: 'GPT 5.4' }, |
| 344 | + { Index: 1, Model: 'GPT 5.5' }, |
| 345 | + ]), |
| 346 | + click: vi.fn().mockResolvedValue(undefined), |
| 347 | + wait: vi.fn().mockResolvedValue(undefined), |
| 348 | + }; |
| 349 | + |
| 350 | + await expect(selectModelCommand.func(page, { name: 'GPT 5' })) |
| 351 | + .rejects.toBeInstanceOf(ArgumentError); |
| 352 | + expect(page.click).toHaveBeenCalledTimes(1); |
| 353 | + expect(page.click).toHaveBeenCalledWith(expect.stringContaining('icd-model-select-trigger')); |
| 354 | + }); |
| 355 | + |
338 | 356 | it('new fails closed when clicking new task does not prove a fresh empty composer', async () => { |
339 | 357 | const page = { |
340 | 358 | evaluate: vi.fn() |
|
0 commit comments