@@ -176,6 +176,7 @@ vi.mock('sonner', () => ({
176176
177177vi . mock ( '@/hooks/useWebSocket' , ( ) => ( {
178178 sendAcknowledgement : vi . fn ( ) ,
179+ useWebSocketEvent : vi . fn ( ) ,
179180} ) )
180181
181182vi . mock ( './TvShowPanelUtils' , ( ) => ( {
@@ -423,7 +424,7 @@ describe('TvShowPanel', () => {
423424 expect ( mockAddTmpPlan ) . not . toHaveBeenCalled ( )
424425 } )
425426
426- it ( 'should trigger rule-based recognition when media files are not recognized' , ( ) => {
427+ it ( 'should not trigger automatic recognition when media files are not recognized' , ( ) => {
427428 const testFolderPath = '/test/unrecognized/path'
428429
429430 // Mock mediaMetadata with null mediaFiles (needs recognition)
@@ -433,16 +434,11 @@ describe('TvShowPanel', () => {
433434 }
434435
435436 render ( < TvShowPanel /> )
436-
437- // Verify recognition was triggered (buildTemporaryRecognitionPlan returns a plan)
438- expect ( mockAddTmpPlan ) . toHaveBeenCalledWith (
439- expect . objectContaining ( {
440- mediaFolderPath : '/test/path' ,
441- } )
442- )
443-
444- // Verify folder was added to initializedMediaFolders
445- expect ( mockSetInitializedMediaFolders ) . toHaveBeenCalledWith ( [ testFolderPath ] )
437+
438+ // Note: Recognition is triggered by user clicking the Recognize button, not automatically
439+ // This test verifies that no automatic recognition happens on render
440+ expect ( mockAddTmpPlan ) . not . toHaveBeenCalled ( )
441+ expect ( mockSetInitializedMediaFolders ) . not . toHaveBeenCalled ( )
446442 } )
447443
448444 it ( 'should not trigger recognition when media files are already recognized' , ( ) => {
@@ -466,7 +462,7 @@ describe('TvShowPanel', () => {
466462 expect ( mockSetInitializedMediaFolders ) . not . toHaveBeenCalled ( )
467463 } )
468464
469- it ( 'should trigger recognition when all media files have nil absolutePath' , ( ) => {
465+ it ( 'should not trigger automatic recognition when media files have nil absolutePath' , ( ) => {
470466 const testFolderPath = '/test/unrecognized/path'
471467
472468 // Mock mediaMetadata with files but all have nil absolutePath
@@ -479,15 +475,10 @@ describe('TvShowPanel', () => {
479475 }
480476
481477 render ( < TvShowPanel /> )
482-
483- // Verify recognition was triggered
484- expect ( mockAddTmpPlan ) . toHaveBeenCalledWith (
485- expect . objectContaining ( {
486- mediaFolderPath : '/test/path' ,
487- } )
488- )
489-
490- // Verify folder was added to initializedMediaFolders
491- expect ( mockSetInitializedMediaFolders ) . toHaveBeenCalledWith ( [ testFolderPath ] )
478+
479+ // Note: Recognition is triggered by user clicking the Recognize button, not automatically
480+ // This test verifies that no automatic recognition happens on render
481+ expect ( mockAddTmpPlan ) . not . toHaveBeenCalled ( )
482+ expect ( mockSetInitializedMediaFolders ) . not . toHaveBeenCalled ( )
492483 } )
493484} )
0 commit comments