@@ -36,6 +36,16 @@ suite('Chat fast-path environment setup', () => {
3636 } as unknown ) as ResolvedEnvironment ;
3737 let tokenSource : CancellationTokenSource ;
3838
39+ function getToolResultText ( content : readonly unknown [ ] ) : string {
40+ return content
41+ . map ( ( part ) =>
42+ typeof part === 'object' && part !== null && 'value' in part && typeof part . value === 'string'
43+ ? part . value
44+ : '' ,
45+ )
46+ . join ( ' ' ) ;
47+ }
48+
3949 setup ( ( ) => {
4050 tokenSource = new CancellationTokenSource ( ) ;
4151 when ( mockedVSCodeNamespaces . workspace ! . notebookDocuments ) . thenReturn ( [ ] ) ;
@@ -268,7 +278,12 @@ suite('Chat fast-path environment setup', () => {
268278 const shouldCreateNewVirtualEnv = sinon . stub ( ) . resolves ( false ) ;
269279 const terminalExecutionService = mock < TerminalCodeExecutionProvider > ( ) ;
270280 const terminalHelper = mock < ITerminalHelper > ( ) ;
271- when ( terminalExecutionService . getExecutableInfo ( resource ) ) . thenResolve ( { command : 'python' , args : [ ] } ) ;
281+ when ( terminalExecutionService . getExecutableInfo ( resource ) ) . thenResolve ( {
282+ command : 'python' ,
283+ args : [ ] ,
284+ python : [ 'python' ] ,
285+ pythonExecutable : 'python' ,
286+ } ) ;
272287 when ( terminalHelper . buildCommandForTerminal ( TerminalShellType . other , 'python' , [ ] ) ) . thenReturn ( 'python' ) ;
273288 const serviceContainer = mock < IServiceContainer > ( ) ;
274289 when ( serviceContainer . get < TerminalCodeExecutionProvider > ( ICodeExecutionService , 'standard' ) ) . thenReturn (
@@ -297,7 +312,7 @@ suite('Chat fast-path environment setup', () => {
297312
298313 const result = await tool . invokeImpl ( options , resource , tokenSource . token ) ;
299314
300- const text = result . content . map ( ( part ) => ( 'value' in part ? part . value : '' ) ) . join ( ' ' ) ;
315+ const text = getToolResultText ( result . content ) ;
301316 expect ( text ) . to . include ( 'A Python Environment has been configured' ) ;
302317 sinon . assert . notCalled ( getRecommendedEnvironment ) ;
303318 sinon . assert . notCalled ( shouldCreateNewVirtualEnv ) ;
@@ -329,7 +344,7 @@ suite('Chat fast-path environment setup', () => {
329344 tokenSource . token ,
330345 ) ;
331346
332- const text = result . content . map ( ( part ) => ( 'value' in part ? part . value : '' ) ) . join ( ' ' ) ;
347+ const text = getToolResultText ( result . content ) ;
333348 expect ( text . toLowerCase ( ) ) . to . include ( 'notebook' ) ;
334349 sinon . assert . notCalled ( update ) ;
335350 } ) ;
0 commit comments