add test
This commit is contained in:
parent
ee7f7365db
commit
3ffae2ffc2
@ -329,6 +329,7 @@ describe('Issue resolution in routing', () => {
|
|||||||
it('should pass selected session ID to interactiveMode when provider is claude', async () => {
|
it('should pass selected session ID to interactiveMode when provider is claude', async () => {
|
||||||
// Given
|
// Given
|
||||||
mockLoadGlobalConfig.mockReturnValue({ interactivePreviewMovements: 3, provider: 'claude' });
|
mockLoadGlobalConfig.mockReturnValue({ interactivePreviewMovements: 3, provider: 'claude' });
|
||||||
|
mockConfirm.mockResolvedValue(true);
|
||||||
mockSelectRecentSession.mockResolvedValue('session-xyz');
|
mockSelectRecentSession.mockResolvedValue('session-xyz');
|
||||||
|
|
||||||
// When
|
// When
|
||||||
@ -344,6 +345,27 @@ describe('Issue resolution in routing', () => {
|
|||||||
expect.anything(),
|
expect.anything(),
|
||||||
'session-xyz',
|
'session-xyz',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
expect(mockConfirm).toHaveBeenCalledWith('Choose a previous session?', false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should not call selectRecentSession when user selects no in confirmation', async () => {
|
||||||
|
// Given
|
||||||
|
mockLoadGlobalConfig.mockReturnValue({ interactivePreviewMovements: 3, provider: 'claude' });
|
||||||
|
mockConfirm.mockResolvedValue(false);
|
||||||
|
|
||||||
|
// When
|
||||||
|
await executeDefaultAction();
|
||||||
|
|
||||||
|
// Then
|
||||||
|
expect(mockConfirm).toHaveBeenCalledWith('Choose a previous session?', false);
|
||||||
|
expect(mockSelectRecentSession).not.toHaveBeenCalled();
|
||||||
|
expect(mockInteractiveMode).toHaveBeenCalledWith(
|
||||||
|
'/test/cwd',
|
||||||
|
undefined,
|
||||||
|
expect.anything(),
|
||||||
|
undefined,
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not call selectRecentSession when provider is not claude', async () => {
|
it('should not call selectRecentSession when provider is not claude', async () => {
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { info, error, withProgress } from '../../shared/ui/index.js';
|
import { info, error, withProgress } from '../../shared/ui/index.js';
|
||||||
|
import { confirm } from '../../shared/prompt/index.js';
|
||||||
import { getErrorMessage } from '../../shared/utils/index.js';
|
import { getErrorMessage } from '../../shared/utils/index.js';
|
||||||
import { getLabel } from '../../shared/i18n/index.js';
|
import { getLabel } from '../../shared/i18n/index.js';
|
||||||
import { fetchIssue, formatIssueAsTask, checkGhCli, parseIssueNumbers, type GitHubIssue } from '../../infra/github/index.js';
|
import { fetchIssue, formatIssueAsTask, checkGhCli, parseIssueNumbers, type GitHubIssue } from '../../infra/github/index.js';
|
||||||
@ -167,9 +168,15 @@ export async function executeDefaultAction(task?: string): Promise<void> {
|
|||||||
let selectedSessionId: string | undefined;
|
let selectedSessionId: string | undefined;
|
||||||
const provider = globalConfig.provider;
|
const provider = globalConfig.provider;
|
||||||
if (provider === 'claude') {
|
if (provider === 'claude') {
|
||||||
const sessionId = await selectRecentSession(resolvedCwd, lang);
|
const shouldSelectSession = await confirm(
|
||||||
if (sessionId) {
|
getLabel('interactive.sessionSelector.confirm', lang),
|
||||||
selectedSessionId = sessionId;
|
false,
|
||||||
|
);
|
||||||
|
if (shouldSelectSession) {
|
||||||
|
const sessionId = await selectRecentSession(resolvedCwd, lang);
|
||||||
|
if (sessionId) {
|
||||||
|
selectedSessionId = sessionId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
result = await interactiveMode(resolvedCwd, initialInput, pieceContext, selectedSessionId);
|
result = await interactiveMode(resolvedCwd, initialInput, pieceContext, selectedSessionId);
|
||||||
|
|||||||
@ -36,6 +36,7 @@ interactive:
|
|||||||
passthrough: "Passthrough"
|
passthrough: "Passthrough"
|
||||||
passthroughDescription: "Pass your input directly as task text"
|
passthroughDescription: "Pass your input directly as task text"
|
||||||
sessionSelector:
|
sessionSelector:
|
||||||
|
confirm: "Choose a previous session?"
|
||||||
prompt: "Resume from a recent session?"
|
prompt: "Resume from a recent session?"
|
||||||
newSession: "New session"
|
newSession: "New session"
|
||||||
newSessionDescription: "Start a fresh conversation"
|
newSessionDescription: "Start a fresh conversation"
|
||||||
|
|||||||
@ -36,6 +36,7 @@ interactive:
|
|||||||
passthrough: "パススルー"
|
passthrough: "パススルー"
|
||||||
passthroughDescription: "入力をそのままタスクとして渡す"
|
passthroughDescription: "入力をそのままタスクとして渡す"
|
||||||
sessionSelector:
|
sessionSelector:
|
||||||
|
confirm: "前回セッションを選択しますか?"
|
||||||
prompt: "直近のセッションを引き継ぎますか?"
|
prompt: "直近のセッションを引き継ぎますか?"
|
||||||
newSession: "新しいセッション"
|
newSession: "新しいセッション"
|
||||||
newSessionDescription: "新しい会話を始める"
|
newSessionDescription: "新しい会話を始める"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user