fix: COD-153 match new session case from palette query

This commit is contained in:
Saqeb Akhter
2026-07-09 11:08:53 -04:00
committed by Aamer Akhter
parent 3d4444ad78
commit 03192d9980
2 changed files with 70 additions and 3 deletions
+24
View File
@@ -43,6 +43,9 @@ function loadPaletteHarness(overrides: Record<string, any> = {}) {
listeners[`list:${event}`] = handler;
}),
};
elements.quickStartCase = {
value: 'plex-previews',
};
const context = vm.createContext({
CodemanApp,
@@ -87,6 +90,7 @@ function loadPaletteHarness(overrides: Record<string, any> = {}) {
],
]);
app.sessionOrder = ['sess-beta', 'sess-alpha'];
app.cases = [{ name: 'plex-previews' }, { name: 'flux-player' }, { name: 'api-tools' }];
app.selectSession = vi.fn();
app.run = vi.fn();
app.closeMobileHeaderUtilities = vi.fn();
@@ -176,6 +180,26 @@ describe('Command-K session palette', () => {
expect(results[1]).toMatchObject({ type: 'new-session', title: 'New session' });
});
it('uses the best matching case for the new-session action', async () => {
const { app, elements } = loadPaletteHarness();
const results = app.buildCommandPaletteItems('flux');
const newSession = results.find((item: any) => item.type === 'new-session');
expect(newSession).toMatchObject({
type: 'new-session',
caseName: 'flux-player',
subtitle: 'Run Claude in flux-player',
});
app.commandPaletteItems = [newSession];
app.commandPaletteActiveIndex = 0;
await app.activateCommandPaletteItem();
expect(elements.quickStartCase.value).toBe('flux-player');
expect(app.run).toHaveBeenCalledTimes(1);
});
it('activates the highlighted session result', async () => {
const { app } = loadPaletteHarness();
app.openCommandPalette();