@@ -425,6 +425,7 @@ describe('Server Startup and Port Handling', () => {
425425 mockedMcpServerConnect = mcpConnectStableMock ;
426426
427427 // Default mock for axios.get
428+ // eslint-disable-next-line @typescript-eslint/unbound-method
428429 vi . mocked ( axios . get ) . mockResolvedValue ( { status : 200 , data : { } } ) ;
429430 } ) ;
430431
@@ -440,7 +441,7 @@ describe('Server Startup and Port Handling', () => {
440441
441442
442443
443- // eslint-disable-next-line @typescript-eslint/unbound-method
444+
444445 expect ( mcs . reloadConfigsFromFile ) . toHaveBeenCalled ( ) ;
445446 expect ( http . createServer ) . toHaveBeenCalled ( ) ;
446447
@@ -481,6 +482,7 @@ describe('Server Startup and Port Handling', () => {
481482 } ) ;
482483
483484 // Mock axios.get specifically for this test
485+ // eslint-disable-next-line @typescript-eslint/unbound-method
484486 vi . mocked ( axios . get ) . mockImplementation ( ( url : string ) => {
485487 if ( url . endsWith ( '/api/ping' ) ) {
486488 return Promise . resolve ( { status : 200 , data : { service : "CodeCompass" , status : "ok" , version : existingServerPingVersion } } ) ;
@@ -493,9 +495,8 @@ describe('Server Startup and Port Handling', () => {
493495
494496 // Expect ServerStartupError with specific message and code
495497
496-
497- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
498498 await expect ( startServer ( '/fake/repo' ) ) . rejects . toThrow (
499+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
499500 expect . objectContaining ( {
500501 name : "ServerStartupError" ,
501502 message : `Port ${ mcs . HTTP_PORT } in use by another CodeCompass instance.` ,
@@ -505,7 +506,7 @@ describe('Server Startup and Port Handling', () => {
505506
506507
507508
508- // eslint-disable-next-line @typescript-eslint/unbound-method
509+
509510 expect ( ml . warn ) . toHaveBeenCalledWith ( `HTTP Port ${ mcs . HTTP_PORT } is already in use. Attempting to ping...` ) ;
510511 // eslint-disable-next-line @typescript-eslint/unbound-method
511512 expect ( axios . get ) . toHaveBeenCalledWith ( `http://localhost:${ mcs . HTTP_PORT } /api/ping` , { timeout : 500 } ) ;
@@ -545,6 +546,7 @@ describe('Server Startup and Port Handling', () => {
545546 } ) ;
546547
547548 // Mock axios.get for /api/ping
549+ // eslint-disable-next-line @typescript-eslint/unbound-method
548550 vi . mocked ( axios . get ) . mockImplementation ( ( url : string ) => {
549551 if ( url . endsWith ( '/api/ping' ) ) { // Ping returns non-CodeCompass response or error
550552 return Promise . resolve ( { status : 200 , data : { service : "OtherService" } } ) ;
@@ -553,6 +555,7 @@ describe('Server Startup and Port Handling', () => {
553555 } ) ;
554556
555557 await expect ( startServer ( '/fake/repo' ) ) . rejects . toThrow (
558+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
556559 expect . objectContaining ( {
557560 name : "ServerStartupError" ,
558561 message : `Port ${ mcs . HTTP_PORT } in use by non-CodeCompass server.` ,
@@ -588,17 +591,17 @@ describe('Server Startup and Port Handling', () => {
588591
589592 const pingError = new Error ( 'Connection refused' ) as NodeJS . ErrnoException ;
590593 pingError . code = 'ECONNREFUSED' ;
594+ // eslint-disable-next-line @typescript-eslint/unbound-method
591595 vi . mocked ( axios . get ) . mockImplementation ( ( url : string ) => {
592596 if ( url . endsWith ( '/api/ping' ) ) {
593597 return Promise . reject ( pingError ) ;
594598 }
595599 return Promise . resolve ( { status : 404 , data : { } } ) ;
596600 } ) ;
597-
598-
601+
599602
600- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
601603 await expect ( startServer ( '/fake/repo' ) ) . rejects . toThrow (
604+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
602605 expect . objectContaining ( {
603606 name : "ServerStartupError" ,
604607 message : `Port ${ mcs . HTTP_PORT } in use or ping failed.` ,
@@ -608,7 +611,7 @@ describe('Server Startup and Port Handling', () => {
608611
609612
610613
611- // eslint-disable-next-line @typescript-eslint/unbound-method
614+
612615 expect ( ml . error ) . toHaveBeenCalledWith ( expect . stringContaining ( `Port ${ mcs . HTTP_PORT } is in use by an unknown service or the existing CodeCompass server is unresponsive to pings.` ) ) ;
613616
614617 expect ( ml . error ) . toHaveBeenCalledWith ( expect . stringContaining ( 'Ping error details: Error: Connection refused' ) ) ;
@@ -633,6 +636,7 @@ describe('Server Startup and Port Handling', () => {
633636 } ) ;
634637
635638 // Mock axios.get for /api/ping
639+ // eslint-disable-next-line @typescript-eslint/unbound-method
636640 vi . mocked ( axios . get ) . mockImplementation ( ( url : string ) => {
637641 if ( url . endsWith ( '/api/ping' ) ) {
638642 return Promise . resolve ( { status : 200 , data : { service : "CodeCompass" , status : "ok" , version : "test-version" } } ) ; // Ping success
@@ -644,10 +648,9 @@ describe('Server Startup and Port Handling', () => {
644648 return Promise . resolve ( { status : 404 , data : { } } ) ;
645649 } ) ;
646650
647-
648-
649- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
651+
650652 await expect ( startServer ( '/fake/repo' ) ) . rejects . toThrow (
653+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
651654 expect . objectContaining ( {
652655 name : "ServerStartupError" ,
653656 // The message might vary slightly based on the exact point of failure in the EADDRINUSE logic for status fetch
@@ -659,7 +662,7 @@ describe('Server Startup and Port Handling', () => {
659662
660663
661664
662- // eslint-disable-next-line @typescript-eslint/unbound-method
665+
663666 expect ( ml . error ) . toHaveBeenCalledWith ( expect . stringContaining ( 'Error fetching status from existing CodeCompass server' ) ) ;
664667 expect ( mockedMcpServerConnect ) . not . toHaveBeenCalled ( ) ;
665668 } ) ;
@@ -679,10 +682,10 @@ describe('Server Startup and Port Handling', () => {
679682 } ) ;
680683
681684 // We need to ensure listen is called to trigger the 'on' setup
682-
683-
684- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
685+
686+
685687 await expect ( startServer ( '/fake/repo' ) ) . rejects . toThrow (
688+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
686689 expect . objectContaining ( {
687690 name : "ServerStartupError" ,
688691 message : `HTTP server error: ${ otherError . message } ` ,
@@ -693,7 +696,7 @@ describe('Server Startup and Port Handling', () => {
693696 // Check that the 'on' handler was attached
694697
695698
696- // eslint-disable-next-line @typescript-eslint/unbound-method
699+
697700 expect ( mockHttpServerOnFn ) . toHaveBeenCalledWith ( 'error' , expect . any ( Function ) ) ;
698701
699702 // Check for the specific error log for non-EADDRINUSE
0 commit comments