mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-04 14:39:42 +02:00
fix: COD-153 match new session case from palette query
This commit is contained in:
committed by
Aamer Akhter
parent
3d4444ad78
commit
03192d9980
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user