@@ -370,21 +370,22 @@ function createSuccessResult(
370370}
371371
372372function setupCodeReviewMocks ( config : ScenarioConfig ) {
373- const executeBash : IPCApi [ "workspace" ] [ "executeBash" ] = async ( _workspaceId , command , _options ) => {
373+ const executeBash : IPCApi [ "workspace" ] [ "executeBash" ] = ( _workspaceId , command ) => {
374374 if ( command . includes ( "git ls-files --others --exclude-standard" ) ) {
375- return createSuccessResult ( config . untrackedFiles . join ( "\n" ) ) ;
375+ return Promise . resolve ( createSuccessResult ( config . untrackedFiles . join ( "\n" ) ) ) ;
376376 }
377377
378378 if ( command . includes ( "--numstat" ) ) {
379- return createSuccessResult ( config . numstatOutput ) ;
379+ return Promise . resolve ( createSuccessResult ( config . numstatOutput ) ) ;
380380 }
381381
382382 if ( command . includes ( "git add --" ) ) {
383- return createSuccessResult ( "" ) ;
383+ return Promise . resolve ( createSuccessResult ( "" ) ) ;
384384 }
385385
386386 if ( command . startsWith ( "git diff" ) || command . includes ( "git diff " ) ) {
387- const pathMatch = command . match ( / - - " ( [ ^ " ] + ) " / ) ;
387+ const pathRegex = / - - " ( [ ^ " ] + ) " / ;
388+ const pathMatch = pathRegex . exec ( command ) ;
388389 const pathFilter = pathMatch ?. [ 1 ] ;
389390 const diffOutput = pathFilter
390391 ? config . diffByFile [ pathFilter ] ?? ""
@@ -393,10 +394,10 @@ function setupCodeReviewMocks(config: ScenarioConfig) {
393394 . join ( "\n\n" ) ;
394395
395396 const truncated = ! pathFilter && config . truncated ? { truncated : config . truncated } : undefined ;
396- return createSuccessResult ( diffOutput , truncated ) ;
397+ return Promise . resolve ( createSuccessResult ( diffOutput , truncated ) ) ;
397398 }
398399
399- return createSuccessResult ( "" ) ;
400+ return Promise . resolve ( createSuccessResult ( "" ) ) ;
400401 } ;
401402
402403 const mockApi = {
@@ -412,7 +413,6 @@ function setupCodeReviewMocks(config: ScenarioConfig) {
412413 } as unknown as IPCApi ;
413414
414415 // @ts -expect-error - mockApi is not typed correctly
415- // eslint-disable-next-line no-restricted-syntax
416416 window . api = mockApi ;
417417
418418 deleteWorkspaceStorage ( config . workspaceId ) ;
@@ -463,7 +463,6 @@ export default meta;
463463type Story = StoryObj < typeof meta > ;
464464
465465export const RichContent : Story = {
466- name : "Rich Content" ,
467466 args : {
468467 workspaceId : scenarioConfigs . rich . workspaceId ,
469468 workspacePath : scenarioConfigs . rich . workspacePath ,
@@ -472,7 +471,6 @@ export const RichContent: Story = {
472471} ;
473472
474473export const TruncatedDiff : Story = {
475- name : "Truncated Diff" ,
476474 args : {
477475 workspaceId : scenarioConfigs . truncated . workspaceId ,
478476 workspacePath : scenarioConfigs . truncated . workspacePath ,
@@ -481,7 +479,6 @@ export const TruncatedDiff: Story = {
481479} ;
482480
483481export const EmptyState : Story = {
484- name : "Empty State" ,
485482 args : {
486483 workspaceId : scenarioConfigs . empty . workspaceId ,
487484 workspacePath : scenarioConfigs . empty . workspacePath ,
0 commit comments