Skip to content

Commit 3efdf36

Browse files
committed
test(tui): add /model shorthand resolution test
1 parent c4155c4 commit 3efdf36

1 file changed

Lines changed: 36 additions & 0 deletions

File tree

apps/kimi-code/test/tui/kimi-tui-message-flow.test.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5126,6 +5126,42 @@ command = "vim"
51265126
expect(refreshProviderModels).not.toHaveBeenCalled();
51275127
});
51285128

5129+
it('resolves /model shorthand to the managed Kimi Code alias', async () => {
5130+
const session = makeSession();
5131+
const { driver } = await makeDriver(session, {
5132+
getConfig: vi.fn(async () => ({
5133+
models: {
5134+
k2: {
5135+
provider: 'managed:kimi-code',
5136+
model: 'kimi-k2',
5137+
maxContextSize: 100,
5138+
displayName: 'Kimi K2',
5139+
capabilities: ['thinking'],
5140+
},
5141+
'kimi-code/k3': {
5142+
provider: 'managed:kimi-code',
5143+
model: 'kimi-k3',
5144+
maxContextSize: 100,
5145+
displayName: 'K3',
5146+
capabilities: ['thinking'],
5147+
},
5148+
},
5149+
defaultModel: 'k2',
5150+
thinking: { enabled: false },
5151+
})),
5152+
});
5153+
5154+
driver.handleUserInput('/model k3');
5155+
5156+
await vi.waitFor(() => {
5157+
const picker = driver.state.editorContainer.children[0];
5158+
expect(picker).toBeInstanceOf(TabbedModelSelectorComponent);
5159+
const output = stripSgr((picker as TabbedModelSelectorComponent).render(120).join('\n'));
5160+
expect(output).toMatch(/ K3\s+Kimi Code/);
5161+
});
5162+
expect(session.setModel).not.toHaveBeenCalled();
5163+
});
5164+
51295165
it('opens /model picker after 2s when OAuth refresh is still pending', async () => {
51305166
const { driver } = await makeDriver(makeSession(), {
51315167
getConfig: vi.fn(async () => ({

0 commit comments

Comments
 (0)